Commit 5adf0c0f authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Remove the field tablename in sections.

parent beb19dc9
doc/database.png

149 KB | W: | H:

doc/database.png

147 KB | W: | H:

doc/database.png
doc/database.png
doc/database.png
doc/database.png
  • 2-up
  • Swipe
  • Onion skin
This diff is collapsed.
......@@ -192,13 +192,9 @@ T("Sort the publications list associated to the section according to the "
"database field. The field has to belong to the table tabelanme. "
"The publications of this section will be sort according to this field")
tp_tablename = \
T("Name of the database table containing the publications shown in this section.")
db.define_table("sections",
Field("section", "string", notnull=True, comment=tp_section),
Field("id_renderers", db.renderers, default=undef_id, notnull=True, label='Render'),
Field("tablename", "string", notnull=True, comment=tp_tablename),
Field("id_renderers", db.renderers, notnull=True, label='Render'),
Field("category_codes", "text", comment=tp_categories),
Field("conditions", "text", comment=tp_conditions),
Field("sort_field", "string", comment=tp_sort_field),
......@@ -209,8 +205,6 @@ db.define_table("sections",
db.sections.id_renderers.requires = \
IS_IN_DB(db, 'renderers.id', 'renderers.renderer')
db.sections.tablename.requires = IS_IN_SET(['publications'])
#-------------------------------------------------------------------------------
#
# metrics tool
......
......@@ -457,7 +457,6 @@ if db(db.sections.id).count() == 0:
db.sections.insert(id=1,
section='Articles',
id_renderers=2,
tablename='publications',
category_codes='ACL, ACLN',
conditions='',
sort_field='preprint',
......@@ -466,7 +465,6 @@ if db(db.sections.id).count() == 0:
db.sections.insert(id=2,
section='Preprints',
id_renderers=4,
tablename='publications',
category_codes='PRE',
conditions='',
sort_field='preprint',
......@@ -475,7 +473,6 @@ if db(db.sections.id).count() == 0:
db.sections.insert(id=3,
section='Actes de conférence',
id_renderers=3,
tablename='publications',
category_codes='ACTI, ACTN',
conditions='',
sort_field='report_numbers',
......@@ -484,7 +481,6 @@ if db(db.sections.id).count() == 0:
db.sections.insert(id=4,
section='Présentations orales',
id_renderers=3,
tablename='publications',
category_codes='COM',
conditions='',
sort_field='report_numbers',
......@@ -493,7 +489,6 @@ if db(db.sections.id).count() == 0:
db.sections.insert(id=5,
section='Rapports',
id_renderers=5,
tablename='publications',
category_codes='AP',
conditions='id_collaborations < 2',
sort_field='report_numbers',
......@@ -502,7 +497,6 @@ if db(db.sections.id).count() == 0:
db.sections.insert(id=6,
section='Rapports de collaboration',
id_renderers=6,
tablename='publications',
category_codes='AP',
conditions='id_collaborations > 1',
sort_field='report_numbers',
......
......@@ -54,15 +54,14 @@ def get_sections(db, selector, list):
# query directive to extract publications for this section
# It includes foreign key constraints and user requirements
# related to team, project, authors and year
tablename = section.tablename
query = selector.query(db[tablename])
query = selector.query(db.publications)
if selector.year_start and not selector.year_end:
query = (query) & (db[tablename].year == selector.year_start)
query = (query) & (db.publications.year == selector.year_start)
elif selector.year_start and selector.year_end:
q_start = db[tablename].year >= selector.year_start
q_end = db[tablename].year <= selector.year_end
q_start = db.publications.year >= selector.year_start
q_end = db.publications.year <= selector.year_end
query = (query) & ((q_start) & (q_end))
# add to the query the directive coming from the section itself
......@@ -80,7 +79,7 @@ def get_sections(db, selector, list):
query = (query) & (q_cat)
if section.conditions:
q_conditions = smart_query(db[tablename], section.conditions)
q_conditions = smart_query(db.publications, section.conditions)
query = (query) & (q_conditions)
section.query = query
......@@ -100,7 +99,7 @@ def get_sections(db, selector, list):
direction = list["axis_direction_%s" % list[level]]
if tablename == 'time':
tablename = section.tablename
tablename = 'publications'
field = db[tablename][fieldname]
if direction == "DESC":
......
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