Skip to content

Commit

Permalink
add identifier to resource_tags table, fix query by tag
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkralidis committed Feb 9, 2017
1 parent 4a7a041 commit 3873984
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions GeoHealthCheck/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ class Tag(DB.Model):


resource_tags = DB.Table('resource_tags',
DB.Column('identifier', DB.Integer, primary_key=True,
autoincrement=True),
DB.Column('tag_id', DB.Integer,
DB.ForeignKey('tag.id')),
DB.Column('resource_identifier', DB.Integer,
Expand Down
2 changes: 1 addition & 1 deletion GeoHealthCheck/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def list_resources(resource_type=None, query=None, tag=None):

if tag is not None:
response['resources'] = models.Resource.query.filter(
models.Tag.name.in_([tag])).all()
models.Resource.tags.any(models.Tag.name.in_([tag]))).all()

if 'resources' not in response:
# No query nor resource_type provided: fetch all resources
Expand Down

0 comments on commit 3873984

Please sign in to comment.