Skip to content

Commit

Permalink
Merge pull request #508 from USEPA/feature/finish-2024-prf-support
Browse files Browse the repository at this point in the history
Feature/finish 2024 prf support
  • Loading branch information
courtneymyers authored Nov 27, 2024
2 parents 9adbe1e + 997e444 commit fa7b666
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
16 changes: 8 additions & 8 deletions app/client/src/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@ export const formioNameField = {
2023: {
frf: "_user_name",
prf: "_user_name",
crf: "", // TODO
crf: "_user_name", // TODO: confirm when the 2023 CRF is created
},
2024: {
frf: "_user_name",
prf: "", // TODO
crf: "", // TODO
prf: "_user_name",
crf: "_user_name", // TODO: confirm when the 2024 CRF is created
},
};

Expand All @@ -180,12 +180,12 @@ export const formioEmailField = {
2023: {
frf: "_user_email",
prf: "_user_email",
crf: "", // TODO
crf: "_user_email", // TODO: confirm when the 2023 CRF is created
},
2024: {
frf: "_user_email",
prf: "", // TODO
crf: "", // TODO
prf: "_user_email",
crf: "_user_email", // TODO: confirm when the 2024 CRF is created
},
};

Expand All @@ -205,7 +205,7 @@ export const formioBapRebateIdField = {
},
2024: {
frf: "", // NOTE: no BAP rebate ID in the FRF
prf: "", // TODO
crf: "", // TODO
prf: "_bap_rebate_id",
crf: "_bap_rebate_id",
},
};
8 changes: 7 additions & 1 deletion app/server/app/utilities/formio.js
Original file line number Diff line number Diff line change
Expand Up @@ -1479,6 +1479,12 @@ function fetchPRFSubmission({ rebateYear, req, res }) {
return res.status(errorStatus).json({ message: errorMessage });
}

/** Modify 2024 PRF's NCES API endpoint URL for local development */
const formSchemaJson =
NODE_ENV === "development" && rebateYear === "2024"
? modifyDatasourceComponentsUrl(schema)
: schema;

/**
* NOTE: We can't just use the returned submission data here because
* Formio returns the string literal 'YES' instead of a base64 encoded
Expand All @@ -1493,7 +1499,7 @@ function fetchPRFSubmission({ rebateYear, req, res }) {
.then((submission) => {
return res.json({
userAccess: true,
formSchema: { url: formioFormUrl, json: schema },
formSchema: { url: formioFormUrl, json: formSchemaJson },
submission,
});
});
Expand Down

0 comments on commit fa7b666

Please sign in to comment.