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

Fixed inconsistent creation of the company application object (frontend) #333

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Changes from all 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
18 changes: 14 additions & 4 deletions src/components/Review/Applications/ApplicationsReviewWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ const filters = [
},
];

const generateRejectReason = (rejectReason) => ({
value: rejectReason,
label: "Reject Reason",
});

const generateRejectedAt = (rejectedAt) => ({
value: rejectedAt ? format(rejectedAt, "yyyy-MM-dd") : "",
label: "Rejected At",
});

const generateRow = ({ companyName, submittedAt, state, rejectReason, motivation, email, rejectedAt }) => ({
fields: {
name: { value: companyName, align: "left" },
Expand All @@ -54,8 +64,8 @@ const generateRow = ({ companyName, submittedAt, state, rejectReason, motivation
payload: {
email: { value: email, label: "Email" },
motivation: { value: motivation, label: "Motivation" },
rejectReason: { value: rejectReason, label: "Reject Reason" },
rejectedAt: { value: rejectedAt ? format(parseISO(rejectedAt), "yyyy-MM-dd") : "", label: "Rejected At" },
rejectReason: generateRejectReason(rejectReason),
rejectedAt: generateRejectedAt(rejectedAt ? parseISO(rejectedAt) : null),
},
});

Expand Down Expand Up @@ -108,8 +118,8 @@ const ApplicationsReviewWidget = ({ addSnackbar, isMobile = false }) => {
fields: { ...fields, state: { value: ApplicationStateLabel.REJECTED } },
payload: {
...payload,
rejectReason,
rejectedAt: format(Date.now(), "yyyy-MM-dd"),
rejectReason: generateRejectReason(rejectReason),
rejectedAt: generateRejectedAt(Date.now()),
},
} }));
}, [setRows]);
Expand Down
Loading