def chart(self): from modules.Record import Record from modules.Tag import Tag from modules.Page import Page record = Record('flame_records','local') tag = Tag('flame_tag','local') _page = Page('flame_page','local') DM = DayAndMonth() strd = DM[0] strm = DM[1] renderDict['pages'] = [] PageList = renderDict['user'].list.split(',') for item in PageList: page = {} d_data = record.Get(strd,item,'day') m_data = record.Get(strm,item,'month') page['log'] = d_data[0] page['mlog'] = m_data[0] page['rate'] = m_data[2] page['labels'] = '|'.join([x.name for x in tag._get(parent=_page._get(name=item)[0].id)]) page['d'] = d_data[1] page['m'] = m_data[1] page['name'] = item renderDict['pages'].append(page) renderDict['name'] = renderDict['user'].nick return self.render.main(renderDict)
def briefing(self): from modules.Balance import Balance from modules.Record import Record from modules.Tag import Tag from modules.Page import Page __page = Page('flame_page','local') tag = Tag('flame_tag','local') DM = DayAndMonth() strd = DM[0] strm = DM[1] record = Record('flame_records','local') balance = Balance('flame_balance','local') renderDict['total'] = balance.Total(renderDict['user'].id) renderDict['left'] = balance.Left(renderDict['user'].id) PageList = renderDict['user'].list.split(',') renderDict['pages'] = [] for item in PageList: _page = __page._get(name=item)[0] page = {} page['tags'] = tag._get(parent=_page.id) page['price'] = _page.click d_data = record.Get(strd,item,'day') m_data = record.Get(strm,item,'month') page['log'] = d_data[0] page['d'] = d_data[1] page['m'] = m_data[1] page['name'] = item renderDict['pages'].append(page) return self.render.briefing(renderDict)