Skip to content

Commit

Permalink
fixing code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
al-rosenthal committed Aug 15, 2023
1 parent f81e413 commit 2c6bc2b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions api/src/services/survey-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ export class SurveyService extends DBService {

// The remaining funding sources with either update if they have a survey_funding_source_id
// or insert new record
surveyData.funding_sources.forEach(async (fundingSource) => {
surveyData.funding_sources.forEach((fundingSource) => {

Check warning on line 734 in api/src/services/survey-service.ts

View check run for this annotation

Codecov / codecov/patch

api/src/services/survey-service.ts#L734

Added line #L734 was not covered by tests
if (fundingSource.survey_funding_source_id) {
// Update funding source
promises.push(

Check warning on line 737 in api/src/services/survey-service.ts

View check run for this annotation

Codecov / codecov/patch

api/src/services/survey-service.ts#L737

Added line #L737 was not covered by tests
Expand All @@ -754,7 +754,7 @@ export class SurveyService extends DBService {
}
});

return Promise.all(promises);
await Promise.all(promises);

Check warning on line 757 in api/src/services/survey-service.ts

View check run for this annotation

Codecov / codecov/patch

api/src/services/survey-service.ts#L757

Added line #L757 was not covered by tests
}

/**
Expand Down
13 changes: 10 additions & 3 deletions app/src/components/fields/StartEndDateFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ interface IStartEndDateFieldsProps {
endDateHelperText?: string;
}

const CalendarStartIcon: React.FC = () => {
return <Icon path={mdiCalendarStart} size={1} />;
};

const CalendarEndIcon: React.FC = () => {
return <Icon path={mdiCalendarEnd} size={1} />;
};

/**
* Start/end date fields - commonly used throughout forms
*
Expand All @@ -42,14 +50,13 @@ const StartEndDateFields: React.FC<IStartEndDateFieldsProps> = (props) => {

const formattedEndDateValue =
(rawEndDateValue && moment(rawEndDateValue).isValid() && moment(rawEndDateValue)) || null;

return (
<LocalizationProvider dateAdapter={AdapterMoment}>
<Grid container item spacing={3}>
<Grid item xs={12} md={4}>
<DatePicker
slots={{
openPickerIcon: () => <Icon path={mdiCalendarStart} size={1} />
openPickerIcon: CalendarStartIcon
}}
slotProps={{
textField: {
Expand Down Expand Up @@ -81,7 +88,7 @@ const StartEndDateFields: React.FC<IStartEndDateFieldsProps> = (props) => {
<Grid item xs={12} md={4}>
<DatePicker
slots={{
openPickerIcon: () => <Icon path={mdiCalendarEnd} size={1} />
openPickerIcon: CalendarEndIcon
}}
slotProps={{
textField: {
Expand Down

0 comments on commit 2c6bc2b

Please sign in to comment.