|
@@ -11,7 +11,7 @@ import time as time
|
|
|
import logging
|
|
|
logger = logging.getLogger('painter')
|
|
|
|
|
|
-def allpathes(reader: ChannelReader, tuple_pathes: dict, days: list, spec=None):
|
|
|
+def ratio_pathes(reader: ChannelReader, tuple_pathes: dict, days: list, spec=None):
|
|
|
count = len(days)
|
|
|
show_detail = True if len(list(tuple_pathes.keys())) == 1 else False
|
|
|
if show_detail == False:
|
|
@@ -19,7 +19,7 @@ def allpathes(reader: ChannelReader, tuple_pathes: dict, days: list, spec=None):
|
|
|
else:
|
|
|
all_datas = None
|
|
|
|
|
|
- for name, tup in tuple_pathes.items():
|
|
|
+ for mchid, tup in tuple_pathes.items():
|
|
|
ch_datas = reader.init_data(count)
|
|
|
for _card_type, _spec in tup:
|
|
|
if spec is not None and _spec != spec:
|
|
@@ -31,7 +31,7 @@ def allpathes(reader: ChannelReader, tuple_pathes: dict, days: list, spec=None):
|
|
|
detail_datas = None
|
|
|
|
|
|
for i, day in enumerate(days):
|
|
|
- data = reader.read(day, name, _card_type, _spec)
|
|
|
+ data = reader.read(day, mchid, _card_type, _spec)
|
|
|
if data is not None:
|
|
|
column_pos = i * 86400
|
|
|
view = ch_datas[:, column_pos:column_pos + 86400]
|
|
@@ -41,10 +41,10 @@ def allpathes(reader: ChannelReader, tuple_pathes: dict, days: list, spec=None):
|
|
|
view = detail_datas[:, column_pos:column_pos + 86400]
|
|
|
view += data
|
|
|
if show_detail:
|
|
|
- yield name, _card_type, _spec, detail_datas
|
|
|
+ yield mchid, _card_type, _spec, detail_datas
|
|
|
if all_datas is not None:
|
|
|
all_datas += ch_datas
|
|
|
- yield name, None, None, ch_datas
|
|
|
+ yield mchid, None, None, ch_datas
|
|
|
|
|
|
if show_detail == False:
|
|
|
yield 'all', None, None, all_datas
|
|
@@ -96,7 +96,7 @@ class ChannelPainter(object):
|
|
|
def paint(self):
|
|
|
reader = ChannelReader()
|
|
|
tuple_pathes = reader.many_tuple_path(self._days, self._chnames, self._card_types, self._spec)
|
|
|
- gen = allpathes(self._reader, tuple_pathes, self._days, self._spec)
|
|
|
+ gen = ratio_pathes(self._reader, tuple_pathes, self._days, self._spec)
|
|
|
if len(self._days) == 0:
|
|
|
return BytesIO()
|
|
|
|