Skip to content

Commit

Permalink
fix: remove excessive converter calls
Browse files Browse the repository at this point in the history
  • Loading branch information
superskip committed Apr 8, 2024
1 parent d64d9a1 commit 7b5ff09
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// @flow
import moment from 'moment';
import { dataElementTypes, ProgramStage } from '../../../../../metaData';
import { convertClientToServer } from '../../../../../converters';
import { ProgramStage } from '../../../../../metaData';
import { convertCategoryOptionsToServer } from '../../../../../converters/clientToServer';

const ignoreAutoGenerateIfApplicable = (stage, firstStageDuringRegistrationEvent) =>
Expand Down Expand Up @@ -53,13 +52,13 @@ export const deriveAutoGenerateEvents = ({
const eventInfo = openAfterEnrollment
? {
status: 'ACTIVE',
occurredAt: convertClientToServer(dateToUseInActiveStatus, dataElementTypes.DATE),
scheduledAt: convertClientToServer(dateToUseInActiveStatus, dataElementTypes.DATE),
occurredAt: dateToUseInActiveStatus,
scheduledAt: dateToUseInActiveStatus,
}
: {
status: 'SCHEDULE',
// for schedule type of events we want to add the standard interval days to the date
scheduledAt: moment(convertClientToServer(dateToUseInScheduleStatus, dataElementTypes.DATE))
scheduledAt: moment(dateToUseInScheduleStatus)
.add(minDaysFromStart, 'days')
.format('YYYY-MM-DD'),
};
Expand Down

0 comments on commit 7b5ff09

Please sign in to comment.