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:
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.