Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulMagos committed Nov 28, 2023
1 parent ef6849b commit 6c96b95
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,3 @@ wcwidth==0.2.12
websockets==9.1
whitenoise==6.6.0
matplotlib~=3.8.2
supabase
supabase-py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.2.7 on 2023-11-28 08:50
# Generated by Django 4.2.7 on 2023-11-28 09:04

from django.db import migrations, models

Expand Down
9 changes: 4 additions & 5 deletions templateRender.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def request_data_for_report(self):
if elapsed < frequency:
continue
pages = report['pages']
report['pages'] = []
report['pages'] = {}
for page in pages:
for i, element in enumerate(page['elements']):
kpis = ','.join(list([str(kpi) for kpi in element['kpis']]))
Expand All @@ -67,11 +67,10 @@ def request_data_for_report(self):
kpis_data = json.loads(kpis_data)['data']
kpis_label = kpis_data['labels']
kpis_data = kpis_data['datasets'][0]['data']
report['pages'].append({str(i + 1):
{'data': kpis_data,
report['pages'][str(i+1)] = {'data': kpis_data,
'labels': kpis_label,
'layout': page['layout'],
'chart_type': element['chart_type']}})
'chart_type': element['chart_type']}
# report to json
self.data.append(report)

Expand Down Expand Up @@ -101,7 +100,7 @@ def to_send(self, date, frequency):

def plot(self, pages, report_name, data):
for i, page in enumerate(pages):
page_layout = data[page].pop("layout")
page_layout = page.pop("layout")
self.plot_graph(range(len(data[page]['data'])), data[page]['data'], 'time', 'value', page_layout,
report_name + "page" + str(i))

Expand Down

0 comments on commit 6c96b95

Please sign in to comment.