Skip to content

Commit

Permalink
fix: use right param
Browse files Browse the repository at this point in the history
  • Loading branch information
janhenrikoverland committed Nov 9, 2023
1 parent fa48568 commit 89b4575
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/i18n-keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const i18nKeys = {
skipOrgUnitOwnership: i18n.t(
'Skip generation of organisation unit ownership data'
),
executeTei: i18n.t('Generate outlier data'),
skipOutliers: i18n.t('Skip generation of outlier data'),
},
},
dataStatistics: {
Expand Down
19 changes: 10 additions & 9 deletions src/pages/analytics/analytics.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ export const lastYearElements = lastYearValues

/* Form checkboxes */
export const analyticsCheckboxes = [
'skipAggregate',
'skipResourceTables',
'skipEvents',
'skipEnrollment',
'skipOrgUnitOwnership',
'executeTei',
].map((key) => ({
key,
label: i18nKeys.analytics.checkboxes[key],
{ key: 'skipAggregate' },
{ key: 'skipResourceTables' },
{ key: 'skipEvents' },
{ key: 'skipEnrollment' },
{ key: 'skipOrgUnitOwnership' },
{ key: 'skipOutliers', checked: true },
].map((obj) => ({
key: obj.key,
checked: Boolean(obj.checked),
label: i18nKeys.analytics.checkboxes[obj.key],
}))
12 changes: 2 additions & 10 deletions src/pages/analytics/use-checkboxes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,8 @@ import { useState } from 'react'
import { analyticsCheckboxes } from './analytics.conf.js'

export const useCheckboxes = () => {
const [checkboxes, setCheckboxes] = useState(() => {
const checkboxes = {}
analyticsCheckboxes.forEach((checkbox) => {
checkboxes[checkbox.key] = {
checked: false,
label: checkbox.label,
}
})
return checkboxes
})
const [checkboxes, setCheckboxes] = useState(analyticsCheckboxes)

const toggleCheckbox = (key) => {
setCheckboxes({
...checkboxes,
Expand Down

0 comments on commit 89b4575

Please sign in to comment.