From 785a85bd85f44996520feee9e960ab2a2fcc5c5f Mon Sep 17 00:00:00 2001 From: "Md. Ashikul Alam" Date: Wed, 5 Jun 2024 19:56:31 +0600 Subject: [PATCH 1/6] fix: amend date of certification for verifying certificate --- .../client/src/i18n/messages/views/verifyCertificate.ts | 4 ++-- .../src/views/VerifyCertificate/VerifyCertificatePage.tsx | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/client/src/i18n/messages/views/verifyCertificate.ts b/packages/client/src/i18n/messages/views/verifyCertificate.ts index 3bf07583c0d..42e86ec8e39 100644 --- a/packages/client/src/i18n/messages/views/verifyCertificate.ts +++ b/packages/client/src/i18n/messages/views/verifyCertificate.ts @@ -29,7 +29,7 @@ interface IVerifyCertificateMessages registar: MessageDescriptor brn: MessageDescriptor drn: MessageDescriptor - createdAt: MessageDescriptor + dateOfCertification: MessageDescriptor toastMessage: MessageDescriptor } @@ -110,7 +110,7 @@ const messagesToDefine: IVerifyCertificateMessages = { defaultMessage: 'Name of registar', description: 'Label for name of registar center' }, - createdAt: { + dateOfCertification: { id: 'verifyCertificate.createdAt', defaultMessage: 'Date of certification', description: 'Label for date of certification' diff --git a/packages/client/src/views/VerifyCertificate/VerifyCertificatePage.tsx b/packages/client/src/views/VerifyCertificate/VerifyCertificatePage.tsx index 697ae1f6041..00e316f45bf 100644 --- a/packages/client/src/views/VerifyCertificate/VerifyCertificatePage.tsx +++ b/packages/client/src/views/VerifyCertificate/VerifyCertificatePage.tsx @@ -477,12 +477,14 @@ export function VerifyCertificatePage() { - {intl.formatMessage(messageToDefine.createdAt)} + {intl.formatMessage( + messageToDefine.dateOfCertification + )} } value={ - {formatDate(new Date(data.createdAt), 'dd MMMM yyyy')} + {formatDate(new Date(), 'dd MMMM yyyy')} } /> From 56178e67078f948e23dde60fe2c525c5acb4f80f Mon Sep 17 00:00:00 2001 From: "Md. Ashikul Alam" Date: Fri, 7 Jun 2024 15:16:57 +0600 Subject: [PATCH 2/6] Revert "fix: amend date of certification for verifying certificate" This reverts commit 785a85bd85f44996520feee9e960ab2a2fcc5c5f. --- .../client/src/i18n/messages/views/verifyCertificate.ts | 4 ++-- .../src/views/VerifyCertificate/VerifyCertificatePage.tsx | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/client/src/i18n/messages/views/verifyCertificate.ts b/packages/client/src/i18n/messages/views/verifyCertificate.ts index 42e86ec8e39..3bf07583c0d 100644 --- a/packages/client/src/i18n/messages/views/verifyCertificate.ts +++ b/packages/client/src/i18n/messages/views/verifyCertificate.ts @@ -29,7 +29,7 @@ interface IVerifyCertificateMessages registar: MessageDescriptor brn: MessageDescriptor drn: MessageDescriptor - dateOfCertification: MessageDescriptor + createdAt: MessageDescriptor toastMessage: MessageDescriptor } @@ -110,7 +110,7 @@ const messagesToDefine: IVerifyCertificateMessages = { defaultMessage: 'Name of registar', description: 'Label for name of registar center' }, - dateOfCertification: { + createdAt: { id: 'verifyCertificate.createdAt', defaultMessage: 'Date of certification', description: 'Label for date of certification' diff --git a/packages/client/src/views/VerifyCertificate/VerifyCertificatePage.tsx b/packages/client/src/views/VerifyCertificate/VerifyCertificatePage.tsx index 00e316f45bf..697ae1f6041 100644 --- a/packages/client/src/views/VerifyCertificate/VerifyCertificatePage.tsx +++ b/packages/client/src/views/VerifyCertificate/VerifyCertificatePage.tsx @@ -477,14 +477,12 @@ export function VerifyCertificatePage() { - {intl.formatMessage( - messageToDefine.dateOfCertification - )} + {intl.formatMessage(messageToDefine.createdAt)} } value={ - {formatDate(new Date(), 'dd MMMM yyyy')} + {formatDate(new Date(data.createdAt), 'dd MMMM yyyy')} } /> From 587464afacd260500c5570616d91974f5f02e9c5 Mon Sep 17 00:00:00 2001 From: "Md. Ashikul Alam" Date: Fri, 7 Jun 2024 16:39:07 +0600 Subject: [PATCH 3/6] fix: show certified date in qr code verification page --- .../i18n/messages/views/verifyCertificate.ts | 4 ++-- .../VerifyCertificatePage.tsx | 22 +++++++++++++++++-- .../useVerificationRecordDetails.ts | 1 + 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/packages/client/src/i18n/messages/views/verifyCertificate.ts b/packages/client/src/i18n/messages/views/verifyCertificate.ts index 3bf07583c0d..9c4f4045527 100644 --- a/packages/client/src/i18n/messages/views/verifyCertificate.ts +++ b/packages/client/src/i18n/messages/views/verifyCertificate.ts @@ -29,7 +29,7 @@ interface IVerifyCertificateMessages registar: MessageDescriptor brn: MessageDescriptor drn: MessageDescriptor - createdAt: MessageDescriptor + certifiedAt: MessageDescriptor toastMessage: MessageDescriptor } @@ -110,7 +110,7 @@ const messagesToDefine: IVerifyCertificateMessages = { defaultMessage: 'Name of registar', description: 'Label for name of registar center' }, - createdAt: { + certifiedAt: { id: 'verifyCertificate.createdAt', defaultMessage: 'Date of certification', description: 'Label for date of certification' diff --git a/packages/client/src/views/VerifyCertificate/VerifyCertificatePage.tsx b/packages/client/src/views/VerifyCertificate/VerifyCertificatePage.tsx index 697ae1f6041..091785eab56 100644 --- a/packages/client/src/views/VerifyCertificate/VerifyCertificatePage.tsx +++ b/packages/client/src/views/VerifyCertificate/VerifyCertificatePage.tsx @@ -50,6 +50,7 @@ import { compact } from 'lodash' import { useVerificationRecordDetails } from './useVerificationRecordDetails' import { useLocationIntl } from '@client/hooks/useLocationIntl' import { generateFullAddress } from '@client/utils/locationUtils' +import { SUBMISSION_STATUS } from '@client/declarations' const Container = styled.div<{ size: string; checking: boolean }>` position: relative; @@ -246,6 +247,20 @@ export function VerifyCertificatePage() { if (isDeathRegistration(data)) return data.deceased?.gender } + const getLastCertifiedDate = (data: RecordDetails) => { + return ( + data.history && + data.history.find( + (h, index, allHistory) => + index - 1 && + allHistory[index]?.regStatus?.toString() === + SUBMISSION_STATUS.CERTIFIED && + allHistory[index + 1]?.regStatus?.toString() !== + SUBMISSION_STATUS.CERTIFIED + ) + )?.date + } + // This function currently supports upto two location levels const getLocation = (data: RecordDetails) => { const location = data.eventLocation @@ -477,12 +492,15 @@ export function VerifyCertificatePage() { - {intl.formatMessage(messageToDefine.createdAt)} + {intl.formatMessage(messageToDefine.certifiedAt)} } value={ - {formatDate(new Date(data.createdAt), 'dd MMMM yyyy')} + {formatDate( + new Date(getLastCertifiedDate(data)), + 'dd MMMM yyyy' + )} } /> diff --git a/packages/client/src/views/VerifyCertificate/useVerificationRecordDetails.ts b/packages/client/src/views/VerifyCertificate/useVerificationRecordDetails.ts index f02e1b03b56..c24e94f6e65 100644 --- a/packages/client/src/views/VerifyCertificate/useVerificationRecordDetails.ts +++ b/packages/client/src/views/VerifyCertificate/useVerificationRecordDetails.ts @@ -48,6 +48,7 @@ const FETCH_RECORD_DETAILS_FOR_VERIFICATION = gql` history { action regStatus + date user { primaryOffice { hierarchy { From 8574026cd721b0aaf469a49f6d874876edd8f37d Mon Sep 17 00:00:00 2001 From: "Md. Ashikul Alam" Date: Fri, 7 Jun 2024 16:43:46 +0600 Subject: [PATCH 4/6] chore: add comment for last certfied date --- .../client/src/views/VerifyCertificate/VerifyCertificatePage.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/client/src/views/VerifyCertificate/VerifyCertificatePage.tsx b/packages/client/src/views/VerifyCertificate/VerifyCertificatePage.tsx index 091785eab56..15a7998ae73 100644 --- a/packages/client/src/views/VerifyCertificate/VerifyCertificatePage.tsx +++ b/packages/client/src/views/VerifyCertificate/VerifyCertificatePage.tsx @@ -248,6 +248,7 @@ export function VerifyCertificatePage() { } const getLastCertifiedDate = (data: RecordDetails) => { + // find when declaration was certified return ( data.history && data.history.find( From b6d868ffbe8367f31c7e496fcd90052010294dc5 Mon Sep 17 00:00:00 2001 From: "Md. Ashikul Alam" Date: Fri, 14 Jun 2024 16:26:03 +0600 Subject: [PATCH 5/6] fix: amend certificate time extraction logic --- .../views/VerifyCertificate/VerifyCertificatePage.tsx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/client/src/views/VerifyCertificate/VerifyCertificatePage.tsx b/packages/client/src/views/VerifyCertificate/VerifyCertificatePage.tsx index 15a7998ae73..c1b2b27663a 100644 --- a/packages/client/src/views/VerifyCertificate/VerifyCertificatePage.tsx +++ b/packages/client/src/views/VerifyCertificate/VerifyCertificatePage.tsx @@ -248,16 +248,11 @@ export function VerifyCertificatePage() { } const getLastCertifiedDate = (data: RecordDetails) => { - // find when declaration was certified + // find first certified action from history sorted in ascending order by time return ( data.history && data.history.find( - (h, index, allHistory) => - index - 1 && - allHistory[index]?.regStatus?.toString() === - SUBMISSION_STATUS.CERTIFIED && - allHistory[index + 1]?.regStatus?.toString() !== - SUBMISSION_STATUS.CERTIFIED + (item) => item?.regStatus?.toString() === SUBMISSION_STATUS.CERTIFIED ) )?.date } From 5e64ffb35688244fddbb3500f4ab5d1abb17a16b Mon Sep 17 00:00:00 2001 From: "Md. Ashikul Alam" Date: Fri, 14 Jun 2024 16:44:00 +0600 Subject: [PATCH 6/6] fix: update certified at message id --- packages/client/src/i18n/messages/views/verifyCertificate.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/src/i18n/messages/views/verifyCertificate.ts b/packages/client/src/i18n/messages/views/verifyCertificate.ts index 9c4f4045527..031cc323c78 100644 --- a/packages/client/src/i18n/messages/views/verifyCertificate.ts +++ b/packages/client/src/i18n/messages/views/verifyCertificate.ts @@ -111,7 +111,7 @@ const messagesToDefine: IVerifyCertificateMessages = { description: 'Label for name of registar center' }, certifiedAt: { - id: 'verifyCertificate.createdAt', + id: 'verifyCertificate.certifiedAt', defaultMessage: 'Date of certification', description: 'Label for date of certification' },