Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions app/logic/participants.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,8 @@ def hasGoneToTraining(participant, term):
Event.isAllVolunteerTraining | Event.isCeltsTraining)
.order_by(Event.isCeltsTraining)
)

if not attended:
return None
if len(attended) > 1:
attended = attended[-1]
return attended.get().event
attended = attended[-1] if len(attended) > 1 else attended[0]
return attended.event

24 changes: 15 additions & 9 deletions app/static/js/userProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,13 @@ $(document).ready(function(){
}

// This function is to disable all the dates before current date in the ban modal End Date picker
$(function(){
var banEndDatepicker = $("#banEndDatepicker");
banEndDatepicker.datepicker({
changeYear: true,
changeMonth: true,
minDate:+1,
dateFormat: "yy-mm-dd",
}).attr('readonly','readonly');
$(function () {
const tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
const year = tomorrow.getFullYear();
const month = String(tomorrow.getMonth() + 1).padStart(2, "0");
const day = String(tomorrow.getDate()).padStart(2, "0");
$("#banEndDatepicker").attr("min",`${year}-${month}-${day}`);
});

/*
Expand Down Expand Up @@ -145,7 +144,14 @@ $(document).ready(function(){
});

$("#banButton").click(function (){
$("#banButton").prop("disabled", true)
if ($("#banButton").data('banOrUnban') == "Ineligible"){
const endDateInput = $("#banEndDatepicker")[0];
if (!endDateInput.checkValidity()) {
endDateInput.reportValidity();
return;
};
};
$("#banButton").prop("disabled", true)
var username = $(this).data("username") //Expected to be the unique username of a user in the database
var route = ($(this).data("banOrUnban")).toLowerCase() //Expected to be "ban" or "unban"

Expand Down
Loading