Commit a062b7fe authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Remove the obsolete list.

parent d3a67c30
""" List controllers
"""
from reporting_tools import (MySelector,
Base,
Person)
BASE_VIEW = 'report.%s'
def hardware():
""" Active hardware for a given period of time, given team, ...
"""
# instantiate the selector
selector = MySelector(virtdb.hardware_selector)
# add constraint to select only hardware item
selector.append_query(db.events.category == 'hardware')
# define virtual field to compute time data
# to be added in the report via extra columns
db.history.duration = Field.Virtual(Base(selector).duration)
# retrieve the records
orderfields = (db.people.last_name, db.history.start_date)
rows = selector.select_active_items(db.history, orderby=orderfields)
# build the header and publish
header = '%s %s' % (T('List of hardware'), selector.header(db))
response.view = BASE_VIEW % request.extension
return dict(footer='', header=header, rows=rows)
def list():
"""list of objects followed by the history table.
"""
# instantiate the selector
selector = MySelector(virtdb.list_selector,
exclude_fields=('category',
'period_start',
'period_end',
'year'))
# handle the category constraint
if selector.category:
selector.append_query(db.people_categories.category == selector.category)
# define virtual field to compute time data
# to be added in the report via extra columns
db.history.duration = Field.Virtual(Person(selector).duration)
# retrieve the records
orderfields=(db.people.last_name, db.history.start_date)
rows = selector.select_active_items(db.history, orderby=orderfields)
# build the header and publish
header = '%s %s' % (T('List'), selector.header(db))
response.view = BASE_VIEW % request.extension
return dict(footer='', header=header, rows=rows)
def people():
"""Active people for a given period of time, given team, ...
"""
# instantiate the selector
selector = MySelector(virtdb.people_selector,
exclude_fields=('category',
'period_start',
'period_end',
'year'))
# add constraints to select category of people
if selector.category:
selector.append_query(db.people_categories.category == selector.category)
# define virtual field to compute time data
# to be added in the report via extra columns
tool = Person(selector)
db.history.time_coverage = Field.Virtual(tool.coverage)
db.people.age = Field.Virtual(tool.age)
# retrieve the record
orderfields = (db.people_categories.category, db.people.last_name)
rows = selector.select_active_items(db.history, orderby=orderfields)
# get the header and publish
header = '%s %s' % (T('List of people '), selector.header(db))
response.view = BASE_VIEW % request.extension
return dict(footer='', header=header, rows=rows)
def responsibilities():
"""Active responsibilities for a person, a given period of time, ...
"""
# instantiate the selector
selector = MySelector(virtdb.responsibilities_selector)
# add constraint to select only hardware item
selector.append_query(db.events.category == 'responsabilité')
# order the records
orderfields = (db.organization_levels.level,
db.people.last_name,
db.history.start_date)
# retrieve the records
rows = selector.select_active_items(db.history, orderby=orderfields)
# columns to be shown in the report
header = '%s %s' % (T('List of responsibilities'), selector.header(db))
response.view = BASE_VIEW % request.extension
return dict(footer='', header=header, rows=rows)
def trainee():
"""Active trainee for a given period of time...
"""
# instantiate the selector
selector = MySelector(virtdb.trainee_selector)
# add constraint to select only trainee item
selector.append_query(db.people_categories.category == 'stagiaire')
# define virtual field to compute time data
# to be added in the report via extra columns
db.history.duration = Field.Virtual(Person(selector).duration)
# order the records
orderfields = (db.people_categories.category,
db.history.start_date,
db.people.last_name)
# retrieve the records
rows = selector.select_active_items(db.history, orderby=orderfields)
# columns to be shown in the report
header = '%s %s' % (T('List of trainee'), selector.header(db))
response.view = BASE_VIEW % request.extension
return dict(footer='', header=header, rows=rows)
{{
from reporting_tools import repr_timedelta
# define columns for virtual fields
duration = {'label': T('Duration'),
'class': '',
'content': lambda row, rc: repr_timedelta(row.history.duration),
'selected': False,
'width': ''}
# regular columns to be displayed in the view
columns = ['people.last_name',
'history.hardware_model']
# labels for regular columns
headers = 'labels'
# virtual fields to be displayed in the view
extracolumns = [duration]
}}
\ No newline at end of file
{{
from reporting_tools import repr_timedelta
# define columns for virtual fields
duration = {'label': T('Duration'),
'class': '',
'content': lambda row, rc: repr_timedelta(row.history.duration),
'selected': False,
'width': ''}
# regular columns to be displayed in the view
columns = ['people.last_name',
'teams.team',
'projects.project',
'people_categories.code',
'events.event',
'history.start_date',
'history.percentage']
# labels for regular columns
headers = 'labels'
# virtual fields to be displayed in the view
extracolumns = [duration]
}}
{{
# define columns for virtual fields
time_coverage = {'label': T('Coverage'),
'class': '',
'content': lambda row, rc: row.history.time_coverage,
'selected': False,
'width': ''}
age = {'label': T('Age'),
'class': '',
'content': lambda row, rc: row.people.age,
'selected': False,
'width': ''}
# regular columns to be displayed in the view
columns = ['people_categories.category',
'people.last_name',
'people_categories.code',
'history.percentage']
# labels for regular columns
headers = 'labels'
# virtual fields to be displayed in the view
extracolumns = [time_coverage, age]
}}
{{
# define columns for virtual fields
# columns to be displayed in the view
columns = ['organization_levels.level',
'people.last_name',
'organizations.organization',
'history.responsibility',
'history.start_date',
'history.end_date']
# labels for regular columns
headers = 'labels'
# virtual fields to be displayed in the view
extracolumns = []
}}
{{
from reporting_tools import repr_timedelta
# define columns for virtual fields
duration = {'label': T('Duration'),
'class': '',
'content': lambda row, rc: repr_timedelta(row.history.duration),
'selected': False,
'width': ''}
# regular columns to be displayed in the view
columns = ['people.last_name',
'people_categories.code',
'history.trainee_category',
'history.start_date',
'history.end_date']
# labels for regular columns
headers = 'labels'
# virtual fields to be displayed in the view
extracolumns = [duration]
}}
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