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

Improve the function get_sections by using the operator &= building query.

parent 9555a843
......@@ -101,16 +101,15 @@ def get_sections(db, selector, row):
query = selector.query(publications)
if selector.year_start and not selector.year_end:
query = (query) & (publications.year == selector.year_start)
query &= publications.year == selector.year_start
elif selector.year_start and selector.year_end:
q_start = publications.year >= selector.year_start
q_end = publications.year <= selector.year_end
query = (query) & ((q_start) & (q_end))
query &= publications.year >= selector.year_start
query &= publications.year <= selector.year_end
if selector.author:
q_author = publications.authors_institute.contains(selector.author)
query = (query) & (q_author)
query &= q_author
# add to the query the directive coming from the section itself
# the publication category and dedicated conditions
......@@ -120,11 +119,11 @@ def get_sections(db, selector, row):
if codes:
q_cat = db.categories.code.belongs(codes)
query = (query) & (q_cat)
query &= q_cat
if section.conditions:
q_conditions = smart_query(publications, section.conditions)
query = (query) & (q_conditions)
query &= q_conditions
section.query = query
......
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