Merge lp:~matsubara/lp-devops-dashboard/929538-incident-reports-record into lp:lp-devops-dashboard
Proposed by
Diogo Matsubara
Status: | Merged |
---|---|
Approved by: | Diogo Matsubara |
Approved revision: | 50 |
Merged at revision: | 48 |
Proposed branch: | lp:~matsubara/lp-devops-dashboard/929538-incident-reports-record |
Merge into: | lp:lp-devops-dashboard |
Diff against target: |
244 lines (+106/-34) 6 files modified
buildout.cfg (+0/-2) src/devops/incidentreports.py (+25/-13) src/devops/tests/sample_data/incident-reports.html (+42/-0) src/devops/tests/test_fetchbugs.py (+0/-11) src/devops/tests/test_incidentreports.py (+31/-0) versions.cfg (+8/-8) |
To merge this branch: | bzr merge lp:~matsubara/lp-devops-dashboard/929538-incident-reports-record |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ian Booth (community) | code | Approve | |
Review via email: mp+92359@code.launchpad.net |
Commit message
fix bug #929538: Wrong calculation of number of days without incident reports
Description of the change
This branch fixes how the day since the last incident report is calculated. The current code does a delta between incident records to find out how many days we had without incidents. The fix take into account the delta between today and the day of the last incident.
Also added tests for the incidentreports.py module and updated some dependencies with the dependencies available in the download-cache.
To post a comment you must log in.
Hi there
I have perhaps a dumb question - if we are intending to show the days since the last incident report, is the comparison used in the code the wrong way around?
89 + if current and ((today() - current) > overall_delta):
90 + overall_delta = today() - current
The above code will end up finding the number of days since the oldest incident report I think? Where as we want the number of days since the latest incident report, so it should be:
if current and ((today() - current) < overall_delta):
The attribute used to hold the delta value, "most_days_ with_no_ incidents" seems incorrectly named now that we are changing the semantics of the calculation. It should now really be called "days_since_ last_incident" .
If what I say above is correct, then the tests are incorrect, eg:
183 + def test_get_ last_reports_ since(self) : ._today = datetime(2011, 11, 9) get_last_ reports_ since() l(self. ir.total_ incidents, 7) l(self. ir.most_ days_with_ no_incidents, 89) l(self. ir.last_ report, '2011-11- 07-LP-some- error')
184 + incidentreports
185 + self.ir.
186 + self.assertEqua
187 + self.assertEqua
188 + self.assertEqua
The latest incident report in the sample data is 2011-11-07 and "today" is 2011-11-09, so I would expect the days since last incident report to be 2.