summaryrefslogtreecommitdiff
path: root/esc-reporting
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2019-10-11 14:42:24 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2019-10-11 14:42:24 +0200
commitebcf0a907b22ffcb26be6a6756e7882e63293cdb (patch)
treef8e121bd7b54a1688dd45d1b550a65bde7bcdce2 /esc-reporting
parent9f60bf87a757e6a50aa92f21e3ea3a8f05c9592c (diff)
ESC: read gzip files correctly
Diffstat (limited to 'esc-reporting')
-rwxr-xr-xesc-reporting/esc-analyze.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/esc-reporting/esc-analyze.py b/esc-reporting/esc-analyze.py
index bdfcf74c..5bf0848d 100755
--- a/esc-reporting/esc-analyze.py
+++ b/esc-reporting/esc-analyze.py
@@ -959,13 +959,17 @@ def runAnalyze():
global cfg, statList
global openhubData, bugzillaData, bugzillaESCData, gerritData, gitData, crashData, weekList, automateData, committersNames
+ weekList = None
x = (cfg['nowDate'] - datetime.timedelta(days=7)).strftime('%Y-%m-%d')
- jsonFileName = 'stats_' + x + '.json'
- gzFilePath = cfg['homedir'] + 'archive/' + jsonFileName + '.gz'
+ gzFilePath = cfg['homedir'] + 'archive/stats_' + x + '.json.gz'
if os.path.isfile(gzFilePath):
- with gzip.open(gzFilePath , 'rb'):
- weekList = util_load_file(jsonFileName)
- else:
+ fp = gzip.open(gzFilePath)
+ content = fp.read()
+ fp.close()
+ if content:
+ weekList = json.loads(content.decode('utf-8'))
+
+ if not weekList:
weekList = util_create_statList()
openhubData = util_load_data_file(cfg['homedir'] + 'dump/openhub_dump.json')