roschaefer / story.board

MIT License
4 stars 4 forks source link

BUG Alert-Trigger gets lost #639

Closed drjakob closed 7 years ago

drjakob commented 7 years ago

BUG: This is a serious bug. The Alert (calving will start in 6 hours, sensor (ALERT_Smaxtec_Kalbung_Emma:KuhNr.206_HofHoeck", ID 111), triggered by "Emma Alarm: Geburtsalarm hat ausgelöst. Geburt ist in 6 bis 12 Stunden erwartet" has been displayed yesterday, 16'00 on the page of Emma. Now its gone. WHY? active Triggers should be stable in history! Otherwise the scroll-back-function has no value if important things gets lost.

matboehm commented 7 years ago

@drjakob So the problem is that this trigger was activated on th 29th of August at 16:00 on the diary page of Emma showing the birth warning and now if I go back to the diary entry at that time the trigger (or the text components which the trigger activated) are not shown anymore in the diary entry, is that correct?

drjakob commented 7 years ago

Correct

drjakob commented 7 years ago

This would be a nice fix before launch on monday for the system to work properly!

matboehm commented 7 years ago

@drjakob Could you you give me the ids of the text components you expected to show up in the diary entry for the calving alert?

drjakob commented 7 years ago

199 for report 3

tillprochaska commented 7 years ago

@matthib: I think this line is the reason for the bug. The conditions_fulfilled doesn’t take the moment of the diary_entry into account. I think something like this could solve this:

(validity_period.nil? || (diary_entry.moment - validity_period.hours <= reading.created_at))
tillprochaska commented 7 years ago

Using the current production data, these are the relevant objects:

Dirary Entry ID: 6124 (2017-08-29 16:00) Text Component ID: 192 Trigger ID: 344 Sensor ID: 111 Report ID: 5

matboehm commented 7 years ago

@tillprochaska Yes, I guess that makes sense and your suggestion to fix it probably works. I don't have the time atm to try it out, but we should definately gie it a try!

drjakob commented 7 years ago

Great!