(resultsPath: str)
| 418 | |
| 419 | |
| 420 | def diffReport(resultsPath: str) -> str: |
| 421 | out = {} |
| 422 | outToday = {} |
| 423 | today = strDateTime()[:10] |
| 424 | |
| 425 | for filename in sorted(glob.glob(resultsPath + '/*.diff')): |
| 426 | if not os.path.isfile(filename): |
| 427 | continue |
| 428 | with open(filename, 'rt') as f: |
| 429 | data = json.loads(f.read()) |
| 430 | uploadedToday = data['date'] == today |
| 431 | for messageId in data['sums']: |
| 432 | sums = data['sums'][messageId] |
| 433 | if OLD_VERSION not in sums: |
| 434 | break |
| 435 | if messageId not in out: |
| 436 | out[messageId] = [0, 0] |
| 437 | out[messageId][0] += sums[OLD_VERSION] |
| 438 | out[messageId][1] += sums['head'] |
| 439 | if uploadedToday: |
| 440 | if messageId not in outToday: |
| 441 | outToday[messageId] = [0, 0] |
| 442 | outToday[messageId][0] += sums[OLD_VERSION] |
| 443 | outToday[messageId][1] += sums['head'] |
| 444 | |
| 445 | html = '<!DOCTYPE html>\n' |
| 446 | html += '<html><head><title>Diff report</title></head><body>\n' |
| 447 | html += '<h1>Diff report</h1>\n' |
| 448 | html += '<h2>Uploaded today</h2>' |
| 449 | html += diffReportFromDict(outToday, 'today') |
| 450 | html += '<h2>All</h2>' |
| 451 | html += diffReportFromDict(out, '') |
| 452 | |
| 453 | return html |
| 454 | |
| 455 | |
| 456 | def generate_package_diff_statistics(filename: str) -> None: |
no test coverage detected