Skip to content

Commit

Permalink
feat: only show active custom forms in gallery
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-mccombs committed Oct 6, 2021
1 parent d4286b2 commit e434e24
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions domains/DataCollection/FormGallery/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const FormGallery = ({
const refreshCustomForms = () => {
setLoading(true);
customFormsQuery(surveyingOrganization).then((forms) => {
console.log(forms)
setCustomForms(forms);
setLoading(false);
});
Expand Down
10 changes: 8 additions & 2 deletions modules/cached-resources/read.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,14 @@ function customFormsQuery(surveyingOrganization) {

return customMultiParamQueryService(5000, 'FormSpecificationsV2', parseParams).then(async (forms) => {
if (forms !== null && forms !== undefined && forms !== '') {
await storeData(forms, 'customForms');
return JSON.parse(JSON.stringify(forms));
let activeForms = []
JSON.parse(JSON.stringify(forms)).forEach((form) => {
if(form.active !== 'false'){
activeForms = activeForms.concat([form])
}
})
await storeData(activeForms, 'customForms');
return activeForms;
}
return getData('customForms').then((customForms) => customForms);
}, (error) => {
Expand Down

0 comments on commit e434e24

Please sign in to comment.