Skip to content

Commit

Permalink
fix(migration-trackedentity): change lastUpdateStartDate to updatedAfter
Browse files Browse the repository at this point in the history
also change lastUpdateEndDate to updatedBefore, and lastUpdatedDuration to updatedWithin
  • Loading branch information
kabaros committed Mar 5, 2024
1 parent d4800d7 commit 2b96d79
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/components/Inputs/LastUpdatedDuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React from 'react'
import { DURATION_VALIDATOR } from '../Duration/DurationField.js'
import { DurationField } from '../index.js'

const NAME = 'lastUpdatedDuration'
const NAME = 'updatedWithin'
const DATATEST = 'input-last-updated-duration'
const LABEL = i18n.t('Last updated duration')
const VALIDATOR = composeValidators(hasValue, DURATION_VALIDATOR)
Expand Down
2 changes: 1 addition & 1 deletion src/components/Inputs/LastUpdatedEndDate.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 = 'lastUpdatedEndDate'
const NAME = 'updatedBefore'
const DATATEST = 'input-last-updated-end-date'
const LABEL = i18n.t('Last updated end date')
const VALIDATOR = composeValidators(OPTIONAL_DATE_VALIDATOR)
Expand Down
2 changes: 1 addition & 1 deletion src/components/Inputs/LastUpdatedStartDate.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 = 'lastUpdatedStartDate'
const NAME = 'updatedAfter'
const DATATEST = 'input-last-updated-start-date'
const LABEL = i18n.t('Last updated start date')
const VALIDATOR = composeValidators(OPTIONAL_DATE_VALIDATOR)
Expand Down
6 changes: 3 additions & 3 deletions src/pages/TEIExport/TEIExport.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ const initialValues = {
programEndDate: '',
compression: '', // disable compression until it is properly implemented in the backend
lastUpdatedFilter: defaultLastUpdatedFilterOption,
lastUpdatedStartDate: '',
lastUpdatedEndDate: '',
lastUpdatedDuration: '',
updatedAfter: '',
updatedBefore: '',
updatedWithin: '',
assignedUserModeFilter: false,
assignedUserMode: defaultAssignedUserModeOption,
includeDeleted: false,
Expand Down
38 changes: 19 additions & 19 deletions src/pages/TEIExport/form-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ const valuesToParams = (
programStartDate,
programEndDate,
lastUpdatedFilter,
lastUpdatedStartDate,
lastUpdatedEndDate,
lastUpdatedDuration,
updatedAfter,
updatedBefore,
updatedWithin,
},
filename
) => {
Expand Down Expand Up @@ -86,17 +86,17 @@ const valuesToParams = (
}

if (lastUpdatedFilter == 'DATE') {
if (lastUpdatedStartDate) {
minParams.lastUpdatedStartDate = lastUpdatedStartDate
if (updatedAfter) {
minParams.updatedAfter = updatedAfter
}

if (lastUpdatedEndDate) {
minParams.lastUpdatedEndDate = lastUpdatedEndDate
if (updatedBefore) {
minParams.updatedBefore = updatedBefore
}
}

if (lastUpdatedFilter == 'DURATION') {
minParams.lastUpdatedDuration = lastUpdatedDuration
minParams.updatedWithin = updatedWithin
}

return Object.keys(minParams)
Expand Down Expand Up @@ -142,25 +142,25 @@ const validate = (values) => {

if (
values.lastUpdatedFilter == 'DATE' &&
values.lastUpdatedStartDate &&
values.lastUpdatedEndDate
values.updatedAfter &&
values.updatedBefore
) {
errors.lastUpdatedStartDate = DATE_BEFORE_VALIDATOR(
values.lastUpdatedStartDate,
values.lastUpdatedEndDate
errors.updatedAfter = DATE_BEFORE_VALIDATOR(
values.updatedAfter,
values.updatedBefore
)
errors.lastUpdatedEndDate = DATE_AFTER_VALIDATOR(
values.lastUpdatedEndDate,
values.lastUpdatedStartDate
errors.updatedBefore = DATE_AFTER_VALIDATOR(
values.updatedBefore,
values.updatedAfter
)
}

if (
values.lastUpdatedFilter == 'DATE' &&
!values.lastUpdatedStartDate &&
!values.lastUpdatedEndDate
!values.updatedAfter &&
!values.updatedBefore
) {
errors.lastUpdatedEndDate = i18n.t(
errors.updatedBefore = i18n.t(
"At least one of the 'last updated' date fields must be specified"
)
}
Expand Down

0 comments on commit 2b96d79

Please sign in to comment.