Skip to content

Commit

Permalink
fix: tonima edits (#29)
Browse files Browse the repository at this point in the history
* correct departure date recommendation, add departure date to roster table

* fix weird datetime situation on roster signup
  • Loading branch information
dtp263 authored Apr 28, 2024
1 parent 6813e8a commit 45f7b94
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export async function up(knex: Knex): Promise<void> {
table.boolean('extraTickets');
table.integer('yearsAttended');
table.json('yearsAtCamp');
table.date('estimatedArrivalDate');
table.date('estimatedDepartureDate');
table.timestamp('estimatedArrivalDate', { useTz: false }).notNullable();
table.timestamp('estimatedDepartureDate', { useTz: false }).notNullable();
table.string('sleepingArrangement');
table.boolean('earlyArrivalInterest');
table.boolean('postBurnInterest');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default class RosterParticipant extends Model {
},
estimatedDepartureDate: {
'ui:description':
'In-camp MANDATORY tear-down occurs at least until 4p on Sunday, September 3th, so it best not be before then.',
'In-camp MANDATORY tear-down occurs at least until 4p on Sunday, September 1st, so it best not be before then.',
},
};

Expand Down
17 changes: 17 additions & 0 deletions packages/backend/routes/roster_participants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import express, { Request, Response, Router } from 'express';
import { DateTime } from 'luxon';
import User from '../models/user/user';
import RosterParticipant from '../models/roster_participant/roster_participant';
import hasPermission from '../middleware/rbac';
Expand Down Expand Up @@ -50,12 +51,28 @@ router.post('/:id', async (req: Request, res: Response) => {

const checkCurrent = await RosterParticipant.query().where(signupScope);

const parsedArrivalDate = DateTime.fromJSDate(
new Date(proposedRosterParticipant.estimatedArrivalDate),
)
.setZone('America/Los_Angeles', { keepLocalTime: true })
.toUTC()
.toJSDate();

const parsedDepartureDate = DateTime.fromJSDate(
new Date(proposedRosterParticipant.estimatedDepartureDate),
)
.setZone('America/Los_Angeles', { keepLocalTime: true })
.toUTC()
.toJSDate();

if (checkCurrent.length > 0) {
delete req.body.id;
await RosterParticipant.query()
.where(signupScope)
.patch({
...req.body,
estimatedArrivalDate: parsedArrivalDate,
estimatedDepartureDate: parsedDepartureDate,
yearsAtCamp: JSON.stringify(proposedRosterParticipant.yearsAtCamp),
});

Expand Down
6 changes: 6 additions & 0 deletions packages/frontend/src/components/RosterTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function RosterTable() {
<TableCell>Referral Name</TableCell>
<TableCell>Sleeping Arrangement</TableCell>
<TableCell>Estimated Arrival</TableCell>
<TableCell>Estimated Departure</TableCell>
<TableCell>Skills</TableCell>
<TableCell>Interested in EA</TableCell>
<TableCell>Interested in Post Burn</TableCell>
Expand Down Expand Up @@ -101,6 +102,11 @@ function RosterTable() {
new Date(participant.rosterParticipant.estimatedArrivalDate),
)}
</TableCell>
<TableCell component="th" scope="row">
{BurningManDateFormatter.format(
new Date(participant.rosterParticipant.estimatedDepartureDate),
)}
</TableCell>
<TableCell component="th" scope="row">
{skillsString(participant.user.skillsOfNote)},
{participant.user.skillsNotInList}
Expand Down

0 comments on commit 45f7b94

Please sign in to comment.