Skip to content

Commit

Permalink
Merge pull request #73 from EyeSeeTea/fix/misc-fixes-nov24
Browse files Browse the repository at this point in the history
Misc fixes nov24
  • Loading branch information
MiquelAdell authored Nov 28, 2024
2 parents 1119f14 + 471fe74 commit e8967b2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
13 changes: 10 additions & 3 deletions src/domain/entities/Questionnaire/QuestionnaireRules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,17 @@ export const getQuestionValueByType = (question: Question): string => {
case "boolean":
return question.value === undefined ? "false" : question.value.toString();
case "date":
return question.value?.toISOString().split("T")[0] ?? "";
try {
return question.value?.toISOString().split("T")[0] ?? "";
} catch (e) {
return ""; //Handle invalid date
}
case "datetime":
return question.value?.toString() ?? "";

try {
return question.value?.toString() ?? "";
} catch (e) {
return ""; //Handle invalid date
}
case "number":
case "text":
return question.value ?? "";
Expand Down
7 changes: 4 additions & 3 deletions src/webapp/components/survey-list/table/SurveyListTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,10 @@ export const SurveyListTable: React.FC<SurveyListTableProps> = ({
<TableCell>{survey.name}</TableCell>
)}

{SURVEYS_WITH_CHILD_COUNT.includes(surveyFormType) && (
<TableCell>{survey.childCount as number}</TableCell>
)}
{SURVEYS_WITH_CHILD_COUNT.includes(surveyFormType) &&
typeof survey.childCount === "number" && (
<TableCell>{survey.childCount}</TableCell>
)}

<TableCell style={{ opacity: 0.5 }}>
{
Expand Down
4 changes: 2 additions & 2 deletions src/webapp/hooks/useSurveys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ export function useSurveys(surveyFormType: SURVEY_FORM_TYPES) {
compositionRoot.surveys.getSurveys
.execute(surveyFormType, orgUnitId, parentSurveyId, makeChunkedCall)
.run(
surveys => {
setSurveys(surveys);
nonPaginatedSurveys => {
setSurveys(nonPaginatedSurveys);
setLoadingSurveys(false);
},
err => {
Expand Down

0 comments on commit e8967b2

Please sign in to comment.