Skip to content

Commit 663f352

Browse files
authored
Merge pull request #1687 from BCStudentSoftwareDevTeam/startDate2
Make Start Date appear
2 parents fab1730 + 1cfc340 commit 663f352

5 files changed

Lines changed: 19 additions & 18 deletions

File tree

app/logic/events.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ def attemptSaveMultipleOfferings(eventData, attachmentFiles = None):
119119
seriesId = calculateNewSeriesId()
120120

121121
# Create separate event data for each event in the series, inheriting from the original eventData
122-
123-
seriesData = sorted(eventData.get('seriesData'), key=lambda x: datetime.strptime(f"{x['eventDate']} {x['startTime']}",'%Y-%m-%d %H:%M'))
122+
seriesData = sorted(eventData.get('seriesData'), key=lambda x: datetime.strptime(x['eventDate'].split(' ')[0] + ' ' + x['startTime'], '%Y-%m-%d %H:%M'))
123+
# 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.
124124
isRepeating = bool(eventData.get('isRepeating'))
125125
with mainDB.atomic() as transaction:
126126
for index, event in enumerate(seriesData):

app/static/js/createEvents.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,7 @@ function loadOfferingsToModal() {
405405

406406
function loadRepeatingOfferingToModal(offering){
407407
var seriesTable = $("#generatedEventsTable");
408-
var eventDate = new Date(offering.date || offering.eventDate).toLocaleDateString();
409-
408+
var eventDate = formatDate(offering.date || offering.eventDate);
410409

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

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

879885
setCharacterLimit($("#inputCharacters"), "#remainingCharacters");
880-
});
881-
882-
883-
884-
885-
886+
});

tests/code/test_bonner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def test_addBonnerCohortToRsvpLog():
113113
BonnerCohort.create(user="neillz", year=currentYear)
114114
BonnerCohort.create(user="khatts", year=currentYear)
115115

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

118118
# Create a test event associated with a Bonner Scholars program
119119
programEvent = Program.create(id = 15,

tests/code/test_event_list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def test_getVolunteerOpportunities(training_events):
7777
@pytest.mark.integration
7878
def test_getUpcomingVolunteerOpportunitiesCount():
7979
with mainDB.atomic() as transaction:
80-
testDate = datetime.strptime("2021-08-01 05:00","%Y-%m-%d %H:%M")
80+
testDate = datetime.strptime("08/01/2021 05:00","%m/%d/%Y %H:%M")
8181
currentTestTerm = Term.get_by_id(5)
8282

8383
# In case any events are put in term 5 in testData, put them into the past.

tests/code/test_events.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ def test_deleteEvent():
772772
@pytest.mark.integration
773773
def test_upcomingEvents():
774774
with mainDB.atomic() as transaction:
775-
testDate = datetime.strptime("2021-08-01 05:00","%Y-%m-%d %H:%M")
775+
testDate = datetime.strptime("08/01/2021 05:00","%m/%d/%Y %H:%M")
776776
dayBeforeTestDate = testDate - timedelta(days=1)
777777

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

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

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

0 commit comments

Comments
 (0)