Skip to content

Commit

Permalink
Refactor createReviewDeclaration status 2 RegStatus
Browse files Browse the repository at this point in the history
The createReviewDeclaration() function was using a incorrect type<string> instead of the RegStatus type.

#7476
  • Loading branch information
Siyasanga committed Aug 19, 2024
1 parent 1854f16 commit fd568b3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
13 changes: 6 additions & 7 deletions packages/client/src/declarations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ export function createReviewDeclaration(
declarationId: string,
formData: IFormData,
event: Event,
status?: string,
status?: RegStatus,
duplicates?: IDuplicates[]
): IDeclaration {
return {
Expand Down Expand Up @@ -1556,12 +1556,11 @@ export const declarationsReducer: LoopReducer<IDeclarationsState, Action> = (
offlineData,
userDetails
)
const downloadedAppStatus: string =
(eventData &&
eventData.registration &&
eventData.registration.status &&
eventData.registration.status[0].type) ||
''
const downloadedAppStatus =
eventData &&
eventData.registration &&
eventData.registration.status &&
eventData.registration.status[0].type
const updateWorkqueue = () =>
updateRegistrarWorkqueue(
userDetails?.practitionerId,
Expand Down
6 changes: 3 additions & 3 deletions packages/client/src/views/PrintRecord/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ import { getRegisterForm } from '@client/forms/register/declaration-selectors'
import { messages as reviewMessages } from '@client/i18n/messages/views/review'
import { Checkbox, Stack } from '@opencrvs/components/lib'
import { printRecordMessages } from '@client/i18n/messages/views/printRecord'
import { Event, History } from '@client/utils/gateway'
import { DECLARED, VALIDATED } from '@client/utils/constants'
import { Event, History, RegStatus } from '@client/utils/gateway'
import { createNamesMap } from '@client/utils/data-formatting'
import { PrintRecordTable as Table } from '@client/views/PrintRecord/Table'

Expand Down Expand Up @@ -884,7 +883,8 @@ export function PrintRecordBody(props: PrintRecordTableProps) {
?.reverse()
?.find(
(history) =>
history.regStatus && [DECLARED, VALIDATED].includes(history.regStatus)
history.regStatus &&
[RegStatus.Declared, RegStatus.Validated].includes(history.regStatus)
)
return (
<div>
Expand Down

0 comments on commit fd568b3

Please sign in to comment.