Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hl overdue notice #2179

Open
wants to merge 5 commits into
base: senior-project
Choose a base branch
from
Open
Changes from 4 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
30 changes: 24 additions & 6 deletions src/views/HousingLottery/studentView/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,17 @@ const StudentView = () => {
console.log('Preference Result:', preferenceResult);

const [dueDate, setDueDate] = useState('');
const [overdue, setOverdue] = useState(false);
useEffect(() => {
housingService.getDueDate().then(setDueDate);
housingService.getDueDate().then((dueDate) => {
const timeTarget = new Date(dueDate + ' 11:59:59 PM').getTime();
const timeNow = new Date().getTime();
if (timeNow > timeTarget) {
setOverdue(true);
}

setDueDate(dueDate);
});
}, []);

const handleAgreementsChange = (allChecked) => {
Expand All @@ -46,11 +55,9 @@ const StudentView = () => {

const handleClick = async () => {
try {
let application_id = nanoid(8),
timeTarget = new Date(dueDate + ' 11:59:59 PM').getTime(),
timeNow = new Date().getTime();
if (timeNow > timeTarget) {
application_id = 'zzz' + timeNow;
let application_id = nanoid(8);
if (overdue) {
application_id = 'zzz' + new Date().getTime();
}
console.log('application_id ' + application_id);
await housingService.addApplicant(application_id, studentApplicantResult);
Expand All @@ -67,6 +74,17 @@ const StudentView = () => {

return (
<Grid container spacing={2} justifyContent="center">
<Grid item xs={10}>
<p>Due Date: {dueDate}</p>
{overdue && (
<p>
You are overdue! Please submit your application form as soon as possible, your
application will be placed after all the applications submitted before yours. If you
believe the "Due Date" is wrong, please don't submit your application and contact
Housing.
</p>
)}
</Grid>
<Grid item xs={10}>
<Instructions />
</Grid>
Expand Down
Loading