Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to the invite cohort #1297

Open
wants to merge 30 commits into
base: development
Choose a base branch
from
Open

Changes to the invite cohort #1297

wants to merge 30 commits into from

Conversation

Mbeweg
Copy link
Contributor

@Mbeweg Mbeweg commented Jul 25, 2024

Issue Description


There is a bug where the Bonner cohort checkbox (#checkBonners) does not remain checked after creating, saving, or editing an event. While the invited Bonner scholars are successfully saved, the checkbox itself appears unchecked when revisiting the event editing page. This can cause confusion for users who may think the cohort was not properly invited.

Fixes issue #1295

Changes


  • Added persistence to the Bonner cohort checkbox so that its state is saved when creating or editing an event.
  • Modified the event form loading logic to correctly populate the #checkBonners checkbox with the previously saved state.
  • Updated the event-form to retrieve the saved cohort invite status from the backend and set the checkbox accordingly.

Testing


  1. Prepare your local development environment and run the application.

    source setup.sh
    checkout BCI1
    database/reset_database.sh test
    flask run
  2. Create a new event, select the Bonner cohort checkbox, and save the event. Verify that upon reloading the page or editing the event, the checkbox remains checked.

  3. Edit an existing event without the Bonner cohort selected, invite Bonners, save, and confirm the checkbox is checked when reopening the event edit page.

@bledsoef bledsoef linked an issue Sep 6, 2024 that may be closed by this pull request
@bledsoef
Copy link
Contributor

bledsoef commented Sep 6, 2024

@Mbeweg is this in a reviewable state?

@doucoureb doucoureb marked this pull request as draft September 6, 2024 19:05
@doucoureb doucoureb marked this pull request as ready for review September 25, 2024 17:25
@WackyWeaver
Copy link
Contributor

I tried to test this a few different ways, and I followed the testing guide. The cohort checkbox did not remained checked for either a previously saved event or a new event. Also, the date picker seemed to break in the branch. I tried to pull development into the branch, but the date picker for the start date still did not seem to function properly. This was not an issue that I was having on Development.

@WackyWeaver
Copy link
Contributor

It looks good! I just wanted to have Finn take one last look before approval.

Copy link
Contributor

@bledsoef bledsoef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you guys did an excellent job getting it to save locally but I guess I have a few problems with the way this is currently being handled.

  1. The checkbox state's are being stored in the session storage, but if I close out and reopen it, or if another user comes along and looks at it, they have no indication that the box was ever checked. I would recommend creating a new table in the database and creating a backend route to update that table.

  2. I feel like once a checkbox has been clicked and saved it should be disabled and grayed out, I cannot really see a circumstance of when they would want to toggle the checkbox status since there is no action to take once it is unselected. If you do end up doing this it may be good to have an indicator (maybe a green "Invited" text next to the cohort names or something) that the cohort was invited.

  3. Whenever we save the page, even if no changes have been made to the cohort checkboxes, it will resubmit all of them meaning that the RSVP log is constantly getting updated with duplicate values.

  4. Steven recommended possibly having the checkboxes and then an "invite" button that will trigger the invitations, update the database, and disable the checkboxes. That way we don't have to worry about the save button duplicating requests. We can just have the "save" form ignore the cohort stuff. This may require us not showing the "Invite cohorts" options until the edit page since we wouldn't be able to invite for an event that hasn't been created yet.

This is a lot, and more has to do with the lack of clarity in the issue than your implementation. If you need clarification feel free to find me or Brian. Nice work guys!

@doucoureb doucoureb requested a review from bledsoef October 31, 2024 12:19
Copy link
Contributor

@bledsoef bledsoef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking over the code it is definitely looking better. A couple things:

The database breaks when trying to reset, this is because you are missing the following line in migrate_db.sh:

pem add app.models.eventCohort.EventCohort

I went ahead and added that line on my local machine to try and see if the rest worked and while you can successfully submit events it is not properly updating the events. This is probably due to some of the other comments I left.

Nice work guys!

app/static/js/createEvents.js Outdated Show resolved Hide resolved
app/static/js/createEvents.js Outdated Show resolved Hide resolved
app/static/js/createEvents.js Outdated Show resolved Hide resolved
app/static/js/createEvents.js Outdated Show resolved Hide resolved
app/static/js/createEvents.js Outdated Show resolved Hide resolved
app/controllers/admin/routes.py Outdated Show resolved Hide resolved
app/controllers/admin/routes.py Outdated Show resolved Hide resolved
app/models/eventCohort.py Outdated Show resolved Hide resolved
@doucoureb doucoureb requested a review from bledsoef November 2, 2024 17:25
@doucoureb doucoureb marked this pull request as draft November 6, 2024 06:49
@doucoureb doucoureb requested a review from BrianRamsay November 6, 2024 06:50
Copy link
Contributor

@bledsoef bledsoef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, just have some logic that needs to be condensed but overall I think its getting pretty close.

app/controllers/admin/routes.py Outdated Show resolved Hide resolved
app/controllers/admin/routes.py Outdated Show resolved Hide resolved
app/controllers/admin/routes.py Outdated Show resolved Hide resolved
app/static/js/createEvents.js Outdated Show resolved Hide resolved
app/static/js/createEvents.js Outdated Show resolved Hide resolved
@doucoureb doucoureb requested a review from bledsoef November 22, 2024 20:56
Copy link
Contributor

@bledsoef bledsoef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good! A couple issues though:

  1. We should disable the checkbox once they have checked and saved it.
  2. Make sure your variables are camel case.
  3. Inviting a cohort on create works well, but inviting on edit does not seem to be working. It will sometimes overwrite existing overwritten cohorts and other times not invite the ones you select at all.

Nice work!

<label class="form-check-label text-truncate w-100" for="cohort-{{year}}">{{year}}-{{year+1}}
<span class="text-muted">({{students|map(attribute='fullName')|join(", ")}})</span>
<input class="form-check-input" type="checkbox" value="{{year}}" name="cohorts[]" id="cohort-{{year}}"
{{ 'checked' if invited_years and year|string in invited_years }}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is checked we should probably disable it so we aren't allowing people to uncheck it since we don't have the functionality to do anything then.

app/controllers/admin/routes.py Outdated Show resolved Hide resolved
app/controllers/admin/routes.py Outdated Show resolved Hide resolved
@stevensonmichel stevensonmichel self-assigned this Dec 30, 2024
@stevensonmichel stevensonmichel marked this pull request as ready for review December 30, 2024 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bonner Cohort Invite
5 participants