Skip to content

Commit

Permalink
fix(migration-trackedentity): change programStateDate to enrollmentEn…
Browse files Browse the repository at this point in the history
…rolledAfter

and same for endDate to enrollmentEnrolledBefore
  • Loading branch information
kabaros committed Mar 5, 2024
1 parent 2b96d79 commit ce2235d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/components/Inputs/ProgramEndDate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React from 'react'
import { OPTIONAL_DATE_VALIDATOR } from '../DatePicker/DatePickerField.js'
import { DatePickerField } from '../index.js'

const NAME = 'programEndDate'
const NAME = 'enrollmentEnrolledBefore'
const DATATEST = 'input-program-end-date'
const LABEL = i18n.t('End date')
const VALIDATOR = composeValidators(OPTIONAL_DATE_VALIDATOR)
Expand Down
2 changes: 1 addition & 1 deletion src/components/Inputs/ProgramStartDate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React from 'react'
import { OPTIONAL_DATE_VALIDATOR } from '../DatePicker/DatePickerField.js'
import { DatePickerField } from '../index.js'

const NAME = 'programStartDate'
const NAME = 'enrollmentEnrolledAfter'
const DATATEST = 'input-program-start-date'
const LABEL = i18n.t('Start date')
const VALIDATOR = composeValidators(OPTIONAL_DATE_VALIDATOR)
Expand Down
4 changes: 2 additions & 2 deletions src/pages/TEIExport/TEIExport.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ const initialValues = {
teiTypeFilter: defaultTEITypeFilterOption,
programStatus: defaultProgramStatusOption,
followUpStatus: defaultFollowUpStatusOption,
programStartDate: '',
programEndDate: '',
enrollmentEnrolledAfter: '',
enrollmentEnrolledBefore: '',
compression: '', // disable compression until it is properly implemented in the backend
lastUpdatedFilter: defaultLastUpdatedFilterOption,
updatedAfter: '',
Expand Down
28 changes: 14 additions & 14 deletions src/pages/TEIExport/form-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ const valuesToParams = (
teiTypeFilter,
programStatus,
followUpStatus,
programStartDate,
programEndDate,
enrollmentEnrolledAfter,
enrollmentEnrolledBefore,
lastUpdatedFilter,
updatedAfter,
updatedBefore,
Expand Down Expand Up @@ -72,12 +72,12 @@ const valuesToParams = (

minParams.followUpStatus = followUpStatus

if (programStartDate) {
minParams.programStartDate = programStartDate
if (enrollmentEnrolledAfter) {
minParams.enrollmentEnrolledAfter = enrollmentEnrolledAfter
}

if (programEndDate) {
minParams.programEndDate = programEndDate
if (enrollmentEnrolledBefore) {
minParams.enrollmentEnrolledBefore = enrollmentEnrolledBefore
}
}

Expand Down Expand Up @@ -127,16 +127,16 @@ const validate = (values) => {

if (
values.teiTypeFilter == 'PROGRAM' &&
values.programStartDate &&
values.programEndDate
values.enrollmentEnrolledAfter &&
values.enrollmentEnrolledBefore
) {
errors.programStartDate = DATE_BEFORE_VALIDATOR(
values.programStartDate,
values.programEndDate
errors.enrollmentEnrolledAfter = DATE_BEFORE_VALIDATOR(
values.enrollmentEnrolledAfter,
values.enrollmentEnrolledBefore
)
errors.programEndDate = DATE_AFTER_VALIDATOR(
values.programEndDate,
values.programStartDate
errors.enrollmentEnrolledBefore = DATE_AFTER_VALIDATOR(
values.enrollmentEnrolledBefore,
values.enrollmentEnrolledAfter
)
}

Expand Down

0 comments on commit ce2235d

Please sign in to comment.