mitoc-trips icon indicating copy to clipboard operation
mitoc-trips copied to clipboard

bug: both a leader and not a leader

Open anishathalye opened this issue 3 years ago • 3 comments

I managed to get into a strange state in https://mitoc-trips.mit.edu/trips/1614/.

I am not a leader, but it still lists me as a leader (though the count of leaders is 1):

Screen Shot 2022-05-17 at 8 17 52 AM

Steps to reproduce

Originally, we had two leaders (me and Kathy). I wanted to change my answer for the "notes" column, so I:

  1. Went to the trip edit view, removed myself as a leader, and clicked submit. This got me into the weird state shown in the screenshot above.
  2. I attempted to fill out the notes field. It had both the "Join as a leader" and "Join as a participant" buttons enabled. When I clicked on the "Join as a leader" button, I got an error response from the server. If I clicked "Join as a participant", I could indeed join as a participant, and it would show my name in the list of leaders (screenshot above) and also as a participant.

Note that Kathy has added me back as a leader through the trip edit interface, so the trip posting doesn't currently reflect the weird state described above.

anishathalye avatar May 17 '22 12:05 anishathalye

Thanks for the bug report, Anish!

First, there's an uncaught exception that happened when you tried to sign up as a leader again. Rather than the signup logic detecting that you were already signed up and explaining that, we just try to insert, violate a SQL uniqueness constraint, and error out. That's what happened with the Server Error:

duplicate key value violates unique constraint "ws_leader­signup_par­ticipant_i­d_trip_id_­..."

That's 100% a bug, and I'll fix that today.

The rest of this is mostly just poor design, and something I hope to fix! An explanation follows, if you're curious.

Immutability at the root

Signups (whether they are from a leader or a participant) are meant to be immutable. You can make the case why folks should be able to edit notes after signing up, but the system is simpler (and covers various edge cases) when we just make signups only able to be created once per trip.

So, that's part of this issue - there's no way (by design) to edit your notes once you're on a trip.

You can only lead a trip, or participate on it

For obvious reasons, you can't exactly be a leader on a trip and a participant on a trip. When you removed yourself as a leader, you actually just removed yourself from the collection of people set to lead the trip. You did not delete your original leader signup. But since you were no longer actually a leader, you were now free to sign up as a participant.

Leaders who "signed up as leader" shouldn't be able to edit the trip

The "sign up as leader" button basically exists to give MITOC leaders on Circuses a guaranteed way to be placed onto the trip, be designated as leaders, and bypass the lottery. We need leaders to make trips happen, so this is both fair to all and a useful feature.

But I designed the feature poorly - once you're signed up as a leader on the trip, you can do anything that the original trip creators can do. You can even delete the entire trip, remove the creators, make yourself the only leader, etc.

Leader signups are confusingly displayed

During Winter School, participants "sign up" for many trips each weekend, but only get placed on one trip. We display all their signup records for posterity, even though they aren't on the trip. These signups have their own section. I should be giving leader signups the same treatment, but I confusingly list them underneath the block of leaders. This is also a bug I need to fix.

The fixes (summary)

  • I need to either make it clear to end users that signup notes can't be edited or just change the system to allow editing in some cases.
  • The UI needs to indicate "leaders who had previously signed up, but are now not on the trip" just like it does normal participants.
  • I need to create lesser-privileged leaders who can't do things like edit the entire collection of leaders just to remove themselves.
  • I need to implement versioning into trip editing: when you edited the total collection of leaders, you didn't so much remove yourself as state "this is the complete group of people leading the trip" - there's a timing bug inherent in that, where you click "edit," somebody else signs up as a leader, you remove yourself (but also accidentally remove them). Ironically, they'll basically find themselves in the same state you were in.

You're not the first to notice this weirdness (maybe the 5th or so; most folks email me), but I figured I'd write it all up since this is a public issue. 😄 Hopefully this motivates me to fix most of the shoddy UX. I'll have updates for you this week!

DavidCain avatar May 17 '22 13:05 DavidCain

Thank you for the detailed explanation!

I'd find it helpful to be able to create/lead a trip but also display notes next to my name in the list of sign-ups shown at the bottom. Is this a feature you'd consider supporting?

anishathalye avatar May 17 '22 20:05 anishathalye

I'd find it helpful to be able to create/lead a trip but also display notes next to my name in the list of sign-ups shown at the bottom. Is this a feature you'd consider supporting?

I'd definitely consider it! Right now, it's not terribly feasible due to the separation between "leaders manually added to trip" and "leaders who signed up," but if we introduce some differences in the type of leader, it could be possible.

DavidCain avatar May 17 '22 21:05 DavidCain