Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 0cc84aa4 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update the metric selector to add the author criteria.

parent 3a9980e7
...@@ -15,13 +15,13 @@ def index(): ...@@ -15,13 +15,13 @@ def index():
"""Main Controller handling metrics. """Main Controller handling metrics.
""" """
publications = db.publications
# get the user constraint. # get the user constraint.
# the selector fields year_start, year_end, id_lists are excluded # the selector fields year_start, year_end, id_lists are excluded
# from the selector query. # from the selector query.
selector = Selector(virtdb.metric_selector, tpl = ('author', 'year_start', 'year_end', 'id_metrics')
exclude_fields=('year_start', selector = Selector(virtdb.metric_selector, exclude_fields=tpl)
'year_end',
'id_metrics'))
# protection # protection
if not selector.id_metrics: if not selector.id_metrics:
...@@ -46,19 +46,23 @@ def index(): ...@@ -46,19 +46,23 @@ def index():
# query directive to count publications including # query directive to count publications including
# foreign key constraints and user requirements # foreign key constraints and user requirements
# related to team, project and year # related to team, project and year
query = selector.query(db.publications) query = selector.query(publications)
if metric.conditions: if metric.conditions:
q_conditions = smart_query(db.publications, metric.conditions) q_conditions = smart_query(publications, metric.conditions)
query = (query) & (q_conditions) query &= q_conditions
if selector.year_start and not selector.year_end: if selector.year_start and not selector.year_end:
query = (query) & (db.publications.year == selector.year_start) query &= (publications.year == selector.year_start)
elif selector.year_start and selector.year_end: elif selector.year_start and selector.year_end:
q_start = db.publications.year >= selector.year_start q_start = publications.year >= selector.year_start
q_end = db.publications.year <= selector.year_end q_end = publications.year <= selector.year_end
query = (query) & ((q_start) & (q_end)) query &= ((q_start) & (q_end))
if selector.author:
q_author = publications.authors_institute.contains(selector.author)
query &= q_author
# get the label along the x and y axis # get the label along the x and y axis
labels = {} labels = {}
...@@ -89,7 +93,7 @@ def index(): ...@@ -89,7 +93,7 @@ def index():
# fill the data block of the Ext.data.Array.Store # fill the data block of the Ext.data.Array.Store
# transform (x, y count) data point into a row of values # transform (x, y count) data point into a row of values
# sum the content of the row # sum the content of the row
count = db.publications.id.count() count = publications.id.count()
rows = db(query).select(fields['vertical'], rows = db(query).select(fields['vertical'],
fields['horizontal'], fields['horizontal'],
count, count,
......
...@@ -13,6 +13,7 @@ virtdb.define_table('metric_selector', ...@@ -13,6 +13,7 @@ virtdb.define_table('metric_selector',
Field('id_teams', 'reference teams', label='Team'), Field('id_teams', 'reference teams', label='Team'),
Field('id_projects', 'reference projects', label='Project'), Field('id_projects', 'reference projects', label='Project'),
Field('id_categories', 'reference categories', label='Category'), Field('id_categories', 'reference categories', label='Category'),
Field('author', 'string'),
Field('id_authors_roles', 'reference authors_roles', label='Role'), Field('id_authors_roles', 'reference authors_roles', label='Role'),
Field('id_metrics', 'reference metrics', label='Metric')) Field('id_metrics', 'reference metrics', label='Metric'))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment