Skip to content
Open
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
5 changes: 3 additions & 2 deletions app/logic/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,9 @@ def attemptSaveMultipleOfferings(eventData, attachmentFiles = None):
seriesId = calculateNewSeriesId()

# Create separate event data for each event in the series, inheriting from the original eventData

seriesData = sorted(eventData.get('seriesData'), key=lambda x: datetime.strptime(f"{x['eventDate']} {x['startTime']}",'%Y-%m-%d %H:%M'))
print("seriesData received:", eventData.get('seriesData'))
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.

I don't think this print statement is needed.

seriesData = sorted(eventData.get('seriesData'), key=lambda x: datetime.strptime(x['eventDate'].split(' ')[0] + ' ' + x['startTime'], '%Y-%m-%d %H:%M'))
# sorts the events in the series by date and time so that the events are created in order and the naming convention of Week 1, Week 2, etc. is consistent with the order of the events.
isRepeating = bool(eventData.get('isRepeating'))
with mainDB.atomic() as transaction:
for index, event in enumerate(seriesData):
Expand Down
23 changes: 12 additions & 11 deletions app/static/js/createEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,7 @@ function loadOfferingsToModal() {

function loadRepeatingOfferingToModal(offering){
var seriesTable = $("#generatedEventsTable");
var eventDate = new Date(offering.date || offering.eventDate).toLocaleDateString();

var eventDate = formatDate(offering.date || offering.eventDate);

seriesTable.append(
"<tr class='eventOffering'>" +
Expand Down Expand Up @@ -686,6 +685,9 @@ $("#cancelEvent").on('click', function (event) {
if ($(this).is(':checked')) {
$("#repeatingEventsNamePicker").val($("#inputEventName").val());
$("#repeatingEventsLocationPicker").val($("#inputEventLocation-main").val());
$("#repeatingEventsStartDate").val($("#startDatePicker-mainOnly").val());
$("#repeatingEventsStartTime").val($("#startTime-main").val());
$("#repeatingEventsEndTime").val($("#endTime-main").val());
$('.addMultipleOfferingEvent').hide();
$("#repeatingEventsDiv").removeClass('d-none');
$("#multipleOfferingSlots").children().remove();
Expand Down Expand Up @@ -748,10 +750,14 @@ $("#cancelEvent").on('click', function (event) {
/*cloning the div with ID multipleOfferingEvent and cloning, changing the ID of each clone going up by 1. This also changes
the ID of the deleteMultipleOffering so that when the trash icon is clicked, that specific row will be deleted*/
$(".addMultipleOfferingEvent").click(function () {
// Get the current value from the main location input
// Get the current value from the main location input and the date input
let mainLocation = $("#inputEventLocation-main").val();
createOfferingModalRow({ eventLocation: mainLocation });
});
let existingRows = $("#multipleOfferingSlots .eventOffering").length;
let mainDate = existingRows === 0 ? $("#startDatePicker-mainOnly").val() : null;
let mainTime = $("#startTime-main").val();
let endTime = $("#endTime-main").val();
createOfferingModalRow({ eventLocation: mainLocation, eventDate: mainDate, startTime: mainTime, endTime: endTime });
});

var minDate = new Date('10/25/1999')
$("#startDatePicker-main").datepicker("option", "minDate", minDate)
Expand Down Expand Up @@ -877,9 +883,4 @@ $("#cancelEvent").on('click', function (event) {
});

setCharacterLimit($("#inputCharacters"), "#remainingCharacters");
});





});
2 changes: 1 addition & 1 deletion tests/code/test_bonner.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def test_addBonnerCohortToRsvpLog():
BonnerCohort.create(user="neillz", year=currentYear)
BonnerCohort.create(user="khatts", year=currentYear)

testDate = datetime.strptime("2025-01-19 05:00","%Y-%m-%d %H:%M")
testDate = datetime.strptime("01/19/2025 05:00","%m/%d/%Y %H:%M")

# Create a test event associated with a Bonner Scholars program
programEvent = Program.create(id = 15,
Expand Down
2 changes: 1 addition & 1 deletion tests/code/test_event_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def test_getVolunteerOpportunities(training_events):
@pytest.mark.integration
def test_getUpcomingVolunteerOpportunitiesCount():
with mainDB.atomic() as transaction:
testDate = datetime.strptime("2021-08-01 05:00","%Y-%m-%d %H:%M")
testDate = datetime.strptime("08/01/2021 05:00","%m/%d/%Y %H:%M")
currentTestTerm = Term.get_by_id(5)

# In case any events are put in term 5 in testData, put them into the past.
Expand Down
6 changes: 3 additions & 3 deletions tests/code/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ def test_deleteEvent():
@pytest.mark.integration
def test_upcomingEvents():
with mainDB.atomic() as transaction:
testDate = datetime.strptime("2021-08-01 05:00","%Y-%m-%d %H:%M")
testDate = datetime.strptime("08/01/2021 05:00","%m/%d/%Y %H:%M")
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.

I want to know why do you have to change this because if there is a reason there are other places in the folder like test_participants > test_getEventLengthInHours() that should be change too.

dayBeforeTestDate = testDate - timedelta(days=1)

# Create a user to run the tests with
Expand Down Expand Up @@ -1329,7 +1329,7 @@ def test_inviteCohortsToEvent():
with app.app_context():
g.current_user = "heggens"

testDate = datetime.strptime("2025-08-01 05:00","%Y-%m-%d %H:%M")
testDate = datetime.strptime("08/01/2025 05:00","%m/%d/%Y %H:%M")
programEvent = Program.create(id = 13,
programName = "Bonner Scholars",
isBonnerScholars = True,
Expand Down Expand Up @@ -1362,7 +1362,7 @@ def test_updateEventCohorts():
with app.app_context():
g.current_user = "heggens"

testDate = datetime.strptime("2025-10-01 05:00","%Y-%m-%d %H:%M")
testDate = datetime.strptime("10/01/2025 05:00","%m/%d/%Y %H:%M")
programEvent = Program.create(id = 13,
programName = "Bonner Scholars",
isBonnerScholars = True,
Expand Down
Loading