fact-project / checklist_page

FACTs shutdown checklist website
1 stars 0 forks source link

startup checklist: update Starter shift end time on submit #4

Open dneise opened 7 years ago

dneise commented 7 years ago

Once the Starter submits the startup-checklist, the currently running Starter shift ends and the shifter takes over. This is done be UPDATEing and entry in the new shiftcalendar table called calendarentry.

The query to find the current Starter shift might look like this:

UPDATE calendarentry c 
JOIN role r ON (c.role_id = r.id)
SET c.end = NOW()
WHERE r.name="Shifter_Awake"
              AND start<NOW()
              AND NOW()<end

The problem comes, when a Starter tries to submit the checklist twice. Then this update will not work, since there is no Starter on shift anymore.

Also, when if just somebody submits the startup-checklist? Then the starter is not on shift anymore. From security point of view this is fine. The shifter will be callend ... then the fallback ... then the developers. .. But restoring the state is not too easy ... I mean sure ... find the last entry in startup_checklist_filled and remove it. Note the created timestamp. Find the Starter entry with the same timestamp and set the endtime to the next "Parker" entry.

However this is all functionality that needs to be coded ... and that ... well ... is just a lot of work. So this must not go wrong ... but it will ...

dneise commented 7 years ago

The last problem can also be solved like this:

Only the person currently being starter can submit the startup-checklist. This might be too much for my PHP foo