From 3c848a3277eab5630ef8b80f36e7448847401364 Mon Sep 17 00:00:00 2001 From: eddumm22 Date: Mon, 6 Oct 2014 12:04:35 -0300 Subject: [PATCH] reports --- wscacicneo/__init__.py | 4 +--- wscacicneo/templates/conf_report.pt | 25 +++++++++++++++++++++++-- wscacicneo/templates/report.pt | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- wscacicneo/test/test_reports.py | 2 +- wscacicneo/views.py | 17 +++++++++-------- 5 files changed, 82 insertions(+), 15 deletions(-) diff --git a/wscacicneo/__init__.py b/wscacicneo/__init__.py index 939edeb..092c71f 100755 --- a/wscacicneo/__init__.py +++ b/wscacicneo/__init__.py @@ -61,7 +61,7 @@ def main(global_config, **settings): # # relatorios cfg.add_route('conf_report', 'relatorios/configuracao') - cfg.add_route('report_hd', 'relatorio/{orgao}/{item}') + cfg.add_route('report_itens', 'relatorio/{nm_orgao}/{attr}/{child}') # cfg.add_route('list', 'list') cfg.add_route('gestao', 'gestao') @@ -75,7 +75,6 @@ def main(global_config, **settings): cfg.add_route('login', 'login') cfg.add_route('loginautentication', 'loginautentication') cfg.add_route('logout', 'logout') - cfg.add_route('reports', 'reports') cfg.add_route('computador', 'computador') cfg.add_route('busca', 'busca') cfg.add_route('gestor', 'gestor') @@ -87,7 +86,6 @@ def main(global_config, **settings): cfg.add_route('processador','processador') cfg.add_route('configcoleta','configcoleta') cfg.add_route('configfav','configfav') - cfg.add_route('reportsgestor','reportsgestor') cfg.add_route('questionarcoleta','questionarcoleta') cfg.add_route('confighome','confighome') cfg.add_route('db','db') diff --git a/wscacicneo/templates/conf_report.pt b/wscacicneo/templates/conf_report.pt index 68d8c7a..9bd3efe 100644 --- a/wscacicneo/templates/conf_report.pt +++ b/wscacicneo/templates/conf_report.pt @@ -9,7 +9,7 @@
@@ -37,7 +37,28 @@ diff --git a/wscacicneo/templates/report.pt b/wscacicneo/templates/report.pt index 73821f6..e8af0fa 100644 --- a/wscacicneo/templates/report.pt +++ b/wscacicneo/templates/report.pt @@ -1,6 +1,53 @@ - +
+
+
+
+
+
+
Data Tables
+
+ + +
+
+
+
+
+
+
+ + + + + + + + + + + + + + + +
ItemQuantidadeOpçoes
${k} + +
+
+
+
+
+
+
+
+
+
+
+
+
+ diff --git a/wscacicneo/test/test_reports.py b/wscacicneo/test/test_reports.py index 004c10c..87ce7b5 100644 --- a/wscacicneo/test/test_reports.py +++ b/wscacicneo/test/test_reports.py @@ -46,7 +46,7 @@ class TestRelatorio(unittest.TestCase): hd = get_doc.get_attribute('hd') self.assertGreater(len(hd.results), 0) - hd_count = get_doc.count_attribute('hd', 'tipo_hd') + hd_count = get_doc.count_attribute('memoria', 'interface_memoria') fd = open('/tmp/teste.json', 'w+') fd.write(json.dumps(hd_count)) fd.close() diff --git a/wscacicneo/views.py b/wscacicneo/views.py index b3d55e7..a49f62c 100755 --- a/wscacicneo/views.py +++ b/wscacicneo/views.py @@ -17,6 +17,7 @@ from wscacicneo.model.user import UserBase from wscacicneo.model.notify import Notify from wscacicneo.model.notify import NotifyBase from wscacicneo.model import coleta_manual +from wscacicneo.model.reports import Reports from liblightbase.lbbase.struct import Base from liblightbase.lbutils import conv @@ -51,7 +52,7 @@ def home(request): return {'project': 'WSCacicNeo'} @view_config(route_name='list_notify', renderer='templates/list_notify.pt') -def reports(request): +def list_notify(request): notify_obj = Notify( orgao = 'deasdsd', id_coleta = 'saudhasd', @@ -198,10 +199,6 @@ def error(request): def configfav(request): return {'project': 'WSCacicNeo'} -@view_config(route_name='reportsgestor', renderer='templates/reportsgestor.pt') -def reportsgestor(request): - return {'project': 'WSCacicNeo'} - @view_config(route_name='questionarcoleta', renderer='templates/questionarcoleta.pt') def questionarcoleta(request): return {'project': 'WSCacicNeo'} @@ -238,9 +235,13 @@ def conf_report(request): search = orgao_obj.search_list_orgaos() return {'orgao_doc': search.results} -@view_config(route_name='report_hd', renderer='templates/report.pt') -def report_hd(request): - return { } +@view_config(route_name='report_itens', renderer='templates/report.pt') +def report_itens(request): + nm_orgao = request.matchdict['nm_orgao'] + attr = request.matchdict['attr'] + child = request.matchdict['child'] + data = Reports(nm_orgao).count_attribute(attr, child) + return {'data': data } @view_config(route_name='post_orgao') def post_orgao(request): -- libgit2 0.21.2