Skip to content

Commit

Permalink
VCM requested changes, edit frosh model, fix radio types
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleyleal committed Jul 6, 2024
1 parent 25392a0 commit 6df57c0
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 105 deletions.
80 changes: 40 additions & 40 deletions client/src/assets/schedule/data.jsx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/src/pages/Profile/PageProfileFrosh.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ const ProfilePageFroshScuntMessage = () => {
<div className="frosh-instagram-container">
<img src={ScuntIcon} alt="Scunt" style={{ filter: darkMode ? 'invert(1)' : 'unset' }} />
<div>
<h2>SkavENGer Hunt!</h2>
<h2>Skule Hunt!</h2>
<p>Find more information about The Hunt by clicking here!</p>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/Profile/PageProfileLeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const ProfilePageLeaderScuntMessage = () => {
<div className="frosh-instagram-container">
<img src={ScuntIcon} alt="Scunt" style={{ filter: darkMode ? 'invert(1)' : 'unset' }} />
<div>
<h2>SkavENGer Hunt!!</h2>
<h2>Skule Hunt!!</h2>
<p>Find more information about Scunt by clicking here!</p>
</div>
</div>
Expand Down
29 changes: 10 additions & 19 deletions client/src/pages/Registration/RegistrationFields.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export const fields = {
},
HealthSafety: {
medicalInfo: {
type: 'dropdown',
type: 'radio',
values: ['Yes', 'No'],
initialSelectedIndex: 1,
label: 'Medical Conditions',
Expand Down Expand Up @@ -375,7 +375,7 @@ export const fields = {
},
},
accommodation: {
type: 'dropdown',
type: 'radio',
label: 'Would you like us to reach out to you about how we can best accommodate you?',
values: ['Yes', 'No'],
initialSelectedIndex: 0,
Expand All @@ -396,9 +396,9 @@ export const fields = {
localStorageKey: 'registration-shirtSize',
},
attendingScunt: {
type: 'dropdown',
type: 'radio',
label:
'Would you like to participate in SkavENGer Hunt!? (It will take place on the evening of Wednesday, August 28th)',
'Would you like to participate in Skule Hunt!? (It will take place on the evening of Wednesday, August 28th)',
values: ['Yes', 'No'],
initialSelectedIndex: 0,
localStorageKey: 'registration-scunt',
Expand All @@ -408,20 +408,11 @@ export const fields = {
scuntInfo: {
type: 'label',
label:
"What is SkavENGer Hunt!? SkavENGer Hunt! is a scavenger hunt around the city of Toronto! Don't miss out on one of the most popular f!rosh week events! Hunt is an exciting night of challenges for all comfort levels.",
"What is Skule Hunt!? Skule Hunt! is a scavenger hunt around the city of Toronto! Don't miss out on one of the most popular f!rosh week events! Hunt is an exciting night of challenges for all comfort levels.",
isBold: true,
},
attendingNiteLifeCarnival: {
type: 'dropdown',
label: 'Would you be interested in attending a carnival with other UofT Departments?',
values: ['Yes', 'No'],
initialSelectedIndex: 0,
isRequiredInput: false,
noEdit: false,
localStorageKey: 'registration-attendingNiteLifeCarnival',
},
attendingRetreat: {
type: 'dropdown',
type: 'radio',
label:
'Would you like to attend an overnight retreat on August 31st-September 1st at Hart House Farms (at an additional cost)?',
values: ['Yes', 'No'],
Expand All @@ -432,7 +423,7 @@ export const fields = {
},

summerLocationQuery: {
type: 'dropdown',
type: 'radio',
label:
'Will you be based in Toronto or the GTA over the summer? (or would you be available for events)',
values: ['Yes', 'No'],
Expand All @@ -451,8 +442,8 @@ export const fields = {
noEdit: false,
localStorageKey: 'registration-moveToToronto',
},
bursary: {
type: 'dropdown',
bursaryRequested: {
type: 'radio',
label: 'Do you require any bursary or financial aid for your Frosh Week ticket?',
values: ['Yes', 'No'],
initialSelectedIndex: 0,
Expand All @@ -461,7 +452,7 @@ export const fields = {
localStorageKey: 'registration-bursary',
},
photograph: {
type: 'dropdown',
type: 'radio',
label: 'Are you okay with being photographed during Frosh Week?',
values: ['Yes', 'No'],
initialSelectedIndex: 0,
Expand Down
61 changes: 19 additions & 42 deletions client/src/pages/Registration/RegistrationForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,46 +48,18 @@ const PageRegistrationForm = ({ editFieldsPage, initialValues, onEditSubmit }) =
return setCanRegister(true);
} else {
try {

const convertedFroshObject = { ...froshObject };

// Convert string values to booleans
if (convertedFroshObject.attendingScunt === 'Yes') {
convertedFroshObject.attendingScunt = true;
} else if (convertedFroshObject.attendingScunt === 'No') {
convertedFroshObject.attendingScunt = false;
}

if (convertedFroshObject.photograph === 'Yes') {
convertedFroshObject.photograph = true;
} else if (convertedFroshObject.photograph === 'No') {
convertedFroshObject.photograph = false;
}

if (convertedFroshObject.accommodation === 'Yes') {
convertedFroshObject.accommodation = true;
} else if (convertedFroshObject.accommodation === 'No') {
convertedFroshObject.accommodation = false;
}

if (convertedFroshObject.summerLocationQuery === 'Yes') {
convertedFroshObject.summerLocationQuery = true;
} else if (convertedFroshObject.summerLocationQuery === 'No') {
convertedFroshObject.summerLocationQuery = false;
}

let formData = new FormData();
for (const [key, value] of Object.entries(convertedFroshObject)) {
for (const [key, value] of Object.entries(froshObject)) {
if (value === undefined) continue;
formData.append(key, value);
}
// for (let [key, value] of formData.entries()) {
// console.log(`${key}: ${value}`);
// }
convertedFroshObject['id'] = user.id;
froshObject['id'] = user.id;
const ReactPDF = await import('@react-pdf/renderer');
const { MakeReceipt } = await import('../../components/MakeReceipt/MakeReceipt');
const dataReceipt = await ReactPDF.pdf(MakeReceipt(convertedFroshObject)).toBlob();
const dataReceipt = await ReactPDF.pdf(MakeReceipt(froshObject)).toBlob();
formData.append('dataReceipt', dataReceipt);
// console.log(formData)
// console.log("form data executed")
Expand Down Expand Up @@ -279,11 +251,11 @@ const PageRegistrationForm = ({ editFieldsPage, initialValues, onEditSubmit }) =
initialSelectedIndices={
editFieldsPage === true
? field.values.reduce((prev, curr, index) => {
if (initialValues[key].includes(curr)) {
prev.push(index);
}
return prev;
}, [])
if (initialValues[key].includes(curr)) {
prev.push(index);
}
return prev;
}, [])
: field.initialSelectedIndices
}
maxCanSelect={field.maxCanSelect}
Expand Down Expand Up @@ -317,8 +289,8 @@ const PageRegistrationForm = ({ editFieldsPage, initialValues, onEditSubmit }) =
<></>
)}
{field.isRequiredInput !== undefined &&
field.isRequiredInput === true &&
field.label !== undefined ? (
field.isRequiredInput === true &&
field.label !== undefined ? (
<p className="text-input-required-star">*</p>
) : (
<></>
Expand Down Expand Up @@ -418,9 +390,11 @@ const PageRegistrationForm = ({ editFieldsPage, initialValues, onEditSubmit }) =
<div>
<h1 className="registration-first-step-title">
{'HELLO ' +
((user?.preferredName === '' || !user?.preferredName
? user?.firstName
: user?.preferredName).toUpperCase())}
(user && (user.preferredName === '' || !user.preferredName)
? user.firstName
: user
? user.preferredName.toUpperCase()
: '')}
</h1>
<h2 className="registration-first-step-subtitle">
LET&apos;S REGISTER FOR UOFT ENGINEERING&apos;S F!ROSH WEEK 2T4
Expand Down Expand Up @@ -458,7 +432,10 @@ const PageRegistrationForm = ({ editFieldsPage, initialValues, onEditSubmit }) =
isDisabled={!canRegister}
/>
<p className="register-terms-of-service" style={{ marginTop: '20px' }}>
Note: We will be making bursary decisions after Frosh week and will refund the amount to the students after the decisions. Our team will reach out to you for more details regarding the bursary program. Bursaries range from partial to complete settlement of the ticket price.
Note: We will be making bursary decisions after Frosh week and will refund
the amount to the students after the decisions. Our team will reach out to
you for more details regarding the bursary program. Bursaries range from
partial to complete settlement of the ticket price.
</p>
</div>
),
Expand Down
2 changes: 1 addition & 1 deletion client/src/util/scunt-judges.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ export const scuntJudges = [
'Hay there! My name is Will I’m a chem 2T5 I’m one of the scunt co-chairs and I L O V E love animal facts',
content: [
'Get sturdy for me',
'Get something new banded from the SUDS, the pit or SkavEnger Hunt’ that wasn’t banned before',
'Get something new banded from the SUDS, the pit or Skule Hunt’ that wasn’t banned before',
'Make fan art of me and Tyler',
'Best performance of“Jamaica there trapped down in…”',
'Bring me a grocery store cake, I’ll pay you back',
Expand Down
2 changes: 1 addition & 1 deletion server/src/middlewares/errorResponseMiddleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function errorResponseMiddleware(err, req, res, next) {
} else if (err.errors) {
// TODO: finish error handling when implementing proper backend validation
statusCode = 400;
errorMessage = err.message;
errorMessage = 'Please provide your full name.';
} else if (err.message === 'INVALID_EMAIL') {
statusCode = 400;
errorMessage = 'Please submit a valid email address.';
Expand Down
4 changes: 4 additions & 0 deletions server/src/models/FroshModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ const FroshSchema = new mongoose.Schema(
type: Boolean, // true is attending scunt, false is not attending
required: true,
},
attendingRetreat: {
type: Boolean, // true is attending retreat, false is not attending
required: true,
},
summerLocationQuery: {
type: Boolean,
required: true,
Expand Down

0 comments on commit 6df57c0

Please sign in to comment.