Skip to content

Add a list of training options to create event page - #1604

Open
Arohasina wants to merge 11 commits into
developmentfrom
required_training_list_create_Event_1564
Open

Add a list of training options to create event page#1604
Arohasina wants to merge 11 commits into
developmentfrom
required_training_list_create_Event_1564

Conversation

@Arohasina

@Arohasina Arohasina commented Aug 1, 2025

Copy link
Copy Markdown
Contributor

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

  • Updated the event creation template to display a user-friendly list of required training options.
  • Ensured all duplicate training entries are removed from the list.
  • Enabled users to choose none, one, or multiple required trainings.
  • Updated the form logic to correctly handle multiple selections.
image

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.
image

@BrianRamsay BrianRamsay changed the title Draft PR -- added a list of training options to create event page Add a list of training options to create event page Nov 11, 2025
@ojmakinde ojmakinde linked an issue Nov 20, 2025 that may be closed by this pull request
@bakobagassas
bakobagassas requested review from BrianRamsay and removed request for BrianRamsay December 5, 2025 21:09
Copilot AI lite review requested due to automatic review settings September 8, 2026 21:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

Copilot AI review requested due to automatic review settings September 8, 2026 21:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

Copilot AI review requested due to automatic review settings September 8, 2026 21:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

Copilot AI review requested due to automatic review settings September 9, 2026 19:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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

  • trainingEvents includes 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 thread app/controllers/admin/routes.py Outdated
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;">
Copilot AI review requested due to automatic review settings September 10, 2026 21:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

Copilot AI review requested due to automatic review settings September 11, 2026 21:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

@github-actions

Copy link
Copy Markdown

View Code Coverage

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.

Required Training list on Create Event page

7 participants