Add a list of training options to create event page - #1604
Open
Arohasina wants to merge 11 commits into
Open
Conversation
bakobagassas
requested review from
BrianRamsay
and removed request for
BrianRamsay
December 5, 2025 21:09
…the event table and the requiredTraining table
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Required training selections are not currently persisted/rehydrated server-side and the new RequiredTraining model has a verified Peewee backref-collision issue.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
app/controllers/admin/routes.py:348
trainingEventsincludes canceled and soft-deleted events; those shouldn’t be selectable as required trainings. Filter them out so the list only contains active training events.
trainingEvents = Event.select().where(Event.isTraining == True).order_by(Event.name)
- Files reviewed: 4/4 changed files
- Comments generated: 5
- Review effort level: Lite
Comment on lines
+4
to
+7
| class RequiredTraining(baseModel): | ||
|
|
||
| event = ForeignKeyField(Event) # The regular event that requires training | ||
| trainingEvent = ForeignKeyField(Event) # The event that is the required training. |
Comment on lines
+190
to
+191
| trainingEvents = Event.select().where(Event.isTraining == True).order_by(Event.name) | ||
|
|
Comment on lines
+894
to
+913
| // Handle "None Required" checkbox behavior | ||
| $('#noTrainingRequired').on('change', function() { | ||
| if ($(this).is(':checked')) { | ||
| // Uncheck all training checkboxes when "None Required" is selected | ||
| $('.training-checkbox').prop('checked', false); | ||
| } | ||
| }); | ||
|
|
||
| // Handle training checkbox behavior | ||
| $('.training-checkbox').on('change', function() { | ||
| if ($(this).is(':checked')) { | ||
| // Uncheck "None Required" when any training is selected | ||
| $('#noTrainingRequired').prop('checked', false); | ||
| } else { | ||
| // If no training checkboxes are checked, check "None Required" | ||
| if ($('.training-checkbox:checked').length === 0) { | ||
| $('#noTrainingRequired').prop('checked', true); | ||
| } | ||
| } | ||
| }); |
Comment on lines
+157
to
+175
| <input class="form-check-input" type="checkbox" value="" id="noTrainingRequired" name="requiredTraining[]" | ||
| {{"checked" if not eventData.requiredTraining or eventData.requiredTraining == ''}}> | ||
| <label class="form-check-label" for="noTrainingRequired"> | ||
| <strong>None Required</strong> | ||
| </label> | ||
| </div> | ||
| {% if trainingEvents %} | ||
| <hr class="my-2"> | ||
| {% set seen_names = {} %} | ||
| {% for training in trainingEvents %} | ||
| {% if training.name not in seen_names %} | ||
| {% set _ = seen_names.update({training.name: training.id}) %} | ||
| <div class="form-check"> | ||
| <input class="form-check-input training-checkbox" type="checkbox" | ||
| value="{{training.id}}" | ||
| id="training_{{training.id}}" | ||
| name="requiredTraining[]" | ||
| {{"checked" if eventData.requiredTraining and training.id|string in eventData.requiredTraining.split(',')}}> | ||
| <label class="form-check-label" for="training_{{training.id}}"> |
Comment on lines
+154
to
+155
| <label class="form-label" for="requiredTraining"><strong>Required Training</strong></label> | ||
| <div class="border rounded p-3" style="max-height: 200px; overflow-y: auto;"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue Description
Fixes #1564
-When we create an event, we should have a list of required training from which the user could choose one or more to complete the training(s). It should be under the start time and end time
Changes
TO DO NEXT:
-Create a dedicated RequiredTraining table: move training options out of the current hardcoded or ad hoc structure into their own persistent model.

-Refactor event-training relationship: establish a relationship between events and required trainings using a foreign key or many-to-many association.
-Link training selections in the event views: display the associated required trainings in event detail and summary views.