ericberman / MyFlightbookWeb

The website and service for MyFlightbook
49 stars 18 forks source link

Add ability for instructor to modify student flights that they have signed. #696

Closed ericberman closed 3 years ago

ericberman commented 3 years ago

Only, of course, if they also have "Add" permission in the logbook.

ericberman commented 3 years ago

Actually just realized that there's already an "Edit" link if your name is on the flight (either due to a "please sign" request, or because you've previously signed it). Only thing is that you don't have access if it's got a valid signature (but if valid signature, why do you need to re-sign?) So I think I will "won't fix" this except possibly to make access a bit more visible.

JPSloan1 commented 3 years ago

The use case for me is I've added and then signed a flight (as instructor) into my student's logbook, and then I realize I did not completely log some specific requirement, so I want to go back and update the comments to reflect that requirement. So I'd want to "edit" after I've signed (and then re-sign if required).

JPSloan1 commented 3 years ago

So maybe make it possible to access "edit" if I have a valid signature, but the change invalidates the signature and I have to re-sign it? Or let me "un sign" so I can see the "edit" ? Or just let me modify it if I'm the one that signed it?

ericberman commented 3 years ago

Where things get complicated was in passing down the fact of your privilege to add flights; doing that requires a database call, so things get a little messy, but what I think I'll do is just let you re-sign a flight with a valid signature (normally, it doesn't give you that option). If you do that, the edit button will show up, so you can do the edit and sign all in one step. Actually cleaner that way in the end, but it means doing a bit of work to carry the privilege state to where it needs to go.

JPSloan1 commented 3 years ago

ok. so if I view the student's logbook I'd see a "sign this entry" link even if I've already signed it, and then in that sign flow I see the edit link? Seems fine to me. But actually I just went to try to sign an unsigned flight and don't see the "edit" link at all -- does that only appear when the student sends for signature? Not when I click "sign this entry" from his logbook? Or maybe not when I'm the one that created the entry in the first place?

ericberman commented 3 years ago

Sorta.

What I'll do is modify the 3rd scenario here slightly so that if a flight is (a) signed, (b) by you, (c) still valid, and (d) they gave you "add" permission, you re-sign that flight and edit it in the process

ericberman commented 3 years ago

The matrix here is crazy complex... There's also the whole issue of instructors signing "ad-hoc" (fingernail scribble rather than having a relationship). Working through it...

ericberman commented 3 years ago

OK, I think I have a slightly clunkier but cleaner model (and one that removes all of the complexity/danger from mucking with the matrix of permissions.)

IF you are viewing a student's logbook and (a) you have permission to add to that logbook, AND (b) there is a flight that you have signed for which the signature is still valid (i.e., underlying flight has not been modified in any ways that are treated as meaningful by the system), THEN you can click "Remove Signature".

Doing this mostly (but not entirely) removes the signature. Rather, it sets it as unsigned but pending a signature from you. I.e., it will show up in your list as if the student had requested that you sign it.

This, of course, makes sense - you removed the signature, you want to remember that you should re-sign it at some point.

But then it can piggyback on the existing functionality that lets you edit a flight for which the student has requested a signature from you.

So to edit a flight you've signed your steps would be:

ericberman commented 3 years ago

Have some more testing to do, but can likely check this in tomorrow.

JPSloan1 commented 3 years ago

OK, seems reasonable to me. Appreciate the responsiveness!

ericberman commented 3 years ago

Have some more testing to do, but can likely check this in tomorrow.