Skip to content

Commit

Permalink
Merge pull request #54 from ola-t/fix_filter
Browse files Browse the repository at this point in the history
Fix filter
  • Loading branch information
atarkowska committed Feb 20, 2018
2 parents d153ca0 + 3d17b70 commit 7976eb8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
14 changes: 4 additions & 10 deletions emgapi/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@


def published_year():
# TODO: workaround for django.db.utils.ProgrammingError:
# (1146, "Table doesn't exist")
try:
years = emg_models.Publication.objects \
.filter(published_year__isnull=False, published_year__gt=0) \
Expand All @@ -45,8 +43,6 @@ def published_year():


def metadata_keywords():
# TODO: workaround for django.db.utils.ProgrammingError:
# (1146, "Table doesn't exist")
try:
keywords = emg_models.VariableNames.objects.all() \
.order_by('var_name') \
Expand All @@ -57,8 +53,6 @@ def metadata_keywords():


def pipeline_version():
# TODO: workaround for django.db.utils.ProgrammingError:
# (1146, "Table doesn't exist")
try:
pipelines = emg_models.Pipeline.objects.all() \
.order_by('release_version').distinct()
Expand All @@ -78,7 +72,7 @@ class PublicationFilter(django_filters.FilterSet):
label='ISBN', help_text='ISBN')

published_year = filters.ChoiceFilter(
choices=published_year(),
choices=published_year,
name='published_year', distinct=True,
label='Published year', help_text='Published year')

Expand Down Expand Up @@ -303,7 +297,7 @@ def filter_instrument_model(self, qs, name, value):
return qs.filter(pk__in=samples)

metadata_key = filters.ChoiceFilter(
choices=metadata_keywords(),
choices=metadata_keywords,
method='filter_metadata_key',
name='metadata_key', distinct=True,
label='Metadata keyword', help_text='Metadata keyword')
Expand Down Expand Up @@ -512,7 +506,7 @@ def filter_instrument_model(self, qs, name, value):
instrument_model__iregex=WORD_MATCH_REGEX.format(value))

metadata_key = filters.ChoiceFilter(
choices=metadata_keywords(),
choices=metadata_keywords,
method='filter_metadata_key',
name='metadata_key', distinct=True,
label='Metadata keyword', help_text='Metadata keyword')
Expand Down Expand Up @@ -594,7 +588,7 @@ class Meta:
class AnalysisJobFilter(RunFilter):

pipeline_version = filters.ChoiceFilter(
choices=pipeline_version(),
choices=pipeline_version,
name='pipeline', distinct=True,
label='Pipeline version', help_text='Pipeline version')

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
_requirements = os.path.join(_base, 'requirements.txt')
_requirements_test = os.path.join(_base, 'requirements-test.txt')

version = "1.0.5"
version = "1.0.6"

install_requirements = []
with open(_requirements) as f:
Expand Down

0 comments on commit 7976eb8

Please sign in to comment.