diff --git a/app/corpora/routes.py b/app/corpora/routes.py index 47fadaf6..1535f834 100644 --- a/app/corpora/routes.py +++ b/app/corpora/routes.py @@ -71,7 +71,8 @@ def corpus(corpus_id): users = users ) if (current_user.is_following_corpus(corpus) or corpus.is_public): - cfas = CorpusFollowerAssociation.query.filter(Corpus.id == corpus_id, CorpusFollowerAssociation.follower_id != current_user.id, CorpusFollowerAssociation. follower_id != corpus.user.id).all() + cfas = CorpusFollowerAssociation.query.filter(Corpus.id == corpus_id, CorpusFollowerAssociation.follower_id != corpus.user.id).all() + print(cfas) return render_template( 'corpora/public_corpus.html.j2', title=corpus.title, diff --git a/app/services/forms.py b/app/services/forms.py index 01b1cdd8..174bdb71 100644 --- a/app/services/forms.py +++ b/app/services/forms.py @@ -168,12 +168,18 @@ class CreateSpacyNLPPipelineJobForm(CreateJobBaseForm): if 'methods' in service_info: if 'encoding_detection' in service_info['methods']: del self.encoding_detection.render_kw['disabled'] - models = [ - x for x in SpaCyNLPPipelineModel.query.order_by(SpaCyNLPPipelineModel.title).all() - if version in x.compatible_service_versions and (x.is_public == True or x.user == current_user) + user_models = [ + x for x in current_user.spacy_nlp_pipeline_models.order_by(SpaCyNLPPipelineModel.title).all() ] - self.model.choices = [('', 'Choose your option')] - self.model.choices += [(x.hashid, f'{x.title} [{x.version}]') for x in models] + models = [ + x for x in SpaCyNLPPipelineModel.query.filter(SpaCyNLPPipelineModel.user != current_user, SpaCyNLPPipelineModel.is_public == True).order_by(SpaCyNLPPipelineModel.title).all() + if version in x.compatible_service_versions + ] + self.model.choices = { + '': [('', 'Choose your option')], + 'Your models': [(x.hashid, f'{x.title} [{x.version}]') for x in user_models], + 'Public models': [(x.hashid, f'{x.title} [{x.version}]') for x in models] + } self.model.default = '' self.version.choices = [(x, x) for x in service_manifest['versions']] self.version.data = version diff --git a/app/static/js/ResourceLists/CorpusFollowerList.js b/app/static/js/ResourceLists/CorpusFollowerList.js index 975e69c1..9db964c1 100644 --- a/app/static/js/ResourceLists/CorpusFollowerList.js +++ b/app/static/js/ResourceLists/CorpusFollowerList.js @@ -23,8 +23,9 @@ class CorpusFollowerList extends ResourceList { }); app.getUser(this.userId).then((user) => { let corpusFollowerAssociations = Object.values(user.corpora[this.corpusId].corpus_follower_associations); - let filteredList = corpusFollowerAssociations.filter(association => association.follower.id != currentUserId); - this.add(filteredList); + // let filteredList = corpusFollowerAssociations.filter(association => association.follower.id != currentUserId); + // this.add(filteredList); + this.add(Object.values(user.corpora[this.corpusId].corpus_follower_associations)); this.isInitialized = true; }); } @@ -42,7 +43,7 @@ class CorpusFollowerList extends ResourceList {