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

fix: support validation of projects with ec code 7.3 #3398

Merged
merged 5 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ describe('validate record', () => {
Place_of_Performance_Zip__c: '02920',
Description__c: 'Sample description',
Subaward_Changed__c: 'No',
IAA_Basic_Conditions__c: '1. It imposes conditions on the use of funds by the agency, department, or part of government receiving funds to carry out the program',
};

it('validates a valid project succesfully', () => validateRecord({
Expand Down
1 change: 1 addition & 0 deletions packages/server/src/arpa_reporter/lib/arpa-ec-codes.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const ecCodes = {
5.21: 'Broadband: Other projects',
7.1: 'Administrative Expenses',
7.2: 'Transfers to Other Units of Government',
7.3: 'Costs Associated with Satisfying Certain Legal and Administrative Requirements of the SLFRF Program After December 31, 2024',
};

module.exports = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,8 @@ async function generateProjectBaseline(records) {
case '3.4':
case '3.5':
case '7.1':
case '7.2': {
case '7.2':
case '7.3': {
return [
null, // first col is blank
ec(record.type),
Expand Down
5 changes: 3 additions & 2 deletions packages/server/src/arpa_reporter/services/validate-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { createRecipient, findRecipient, updateRecipient } = require('../db/arpa-
const { recordsForUpload, TYPE_TO_SHEET_NAME } = require('./records');
const { getRules } = require('./validation-rules');
const { ecCodes } = require('../lib/arpa-ec-codes');
const { multiselect } = require('../lib/format');

const ValidationError = require('../lib/validation-error');

Expand Down Expand Up @@ -291,7 +292,7 @@ async function validateRecord({ upload, record, typeRules: rules }) {
// make sure pick value is one of pick list values
if (rule.listVals.length > 0) {
// enforce validation in lower case
const lcItems = rule.listVals.map((val) => val.toLowerCase());
const lcItems = rule.listVals.map((val) => multiselect(val.toLowerCase()));

// for pick lists, the value must be one of possible values
if (rule.dataType === 'Pick List' && !lcItems.includes(value)) {
Expand All @@ -307,7 +308,7 @@ async function validateRecord({ upload, record, typeRules: rules }) {
for (const entry of entries) {
if (!lcItems.includes(entry)) {
errors.push(new ValidationError(
`Entry '${entry}' of ${key} is not one of ${lcItems.length} valid options`,
`Entry '${entry}' of ${key} is not one of ${lcItems.length} valid options (${JSON.stringify(lcItems)})`,
{ col: rule.columnName, severity: 'err' },
));
}
Expand Down
Loading