Skip to content

Commit

Permalink
Fixed lint error and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
shahanneda committed May 18, 2024
1 parent c0e5aef commit d3a7c2b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 2 additions & 4 deletions backend/tests/graphql/test_meal_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ def test_create_meal_request_fails_repeat_date(
donor_onsite_contact,
) = onsite_contact_setup
_, _, meal_request = meal_request_setup
print("-------------------------")
print(f"The meal request is {meal_request.drop_off_datetime}")

# drop_off_datetime is currently a string, so we need to convert it to a datetime object

Expand All @@ -185,7 +183,7 @@ def test_create_meal_request_fails_repeat_date(
portions: 40,
dietaryRestrictions: "7 gluten free, 7 no beef",
}},
onsiteStaff: ["{asp_onsite_contact.id}"],
onsiteContacts: ["{asp_onsite_contact.id}"],
requestorId: "{str(asp.id)}",
requestDates: [
"2025-06-01",
Expand All @@ -201,7 +199,7 @@ def test_create_meal_request_fails_repeat_date(
portions
dietaryRestrictions
}}
onsiteStaff{{
onsiteContacts{{
id
}}
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,17 @@ const SchedulingFormReviewAndSubmit: React.FunctionComponent<SchedulingFormRevie
) {
// The last word is the date
const date = (e as Error).message.split(" ").pop();
if (!date) {
errorMessage = "Failed to create meal request. Please try again.";
toast({
title: errorMessage,
status: "error",
isClosable: true,
});
return;
}
// Construct a date object from the string
const dateObj = new Date(date!);
const dateObj = new Date(date);

errorMessage = `You have already created a meal request on ${dateObj.toDateString()}. Please choose another date, or edit your existing meal request.`;
} else {
Expand Down

0 comments on commit d3a7c2b

Please sign in to comment.