Skip to content

Commit

Permalink
[38] Update linelist columns (#39)
Browse files Browse the repository at this point in the history
* Add date modified and last modified by to linelist

* Remove logs
  • Loading branch information
stanislaw-zakrzewski authored Oct 25, 2023
1 parent e76149e commit e2a23ca
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 8 deletions.
2 changes: 2 additions & 0 deletions data-serving/data-service/src/controllers/case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ const updatedRevisionMetadata = (
updateMetadata: {
curator: curator,
note: note,
date: Date.now(),
},
revisionNumber: day0Case.revisionMetadata.revisionNumber + 1,
};
Expand Down Expand Up @@ -503,6 +504,7 @@ export class CasesController {
revisionNumber: 0,
creationMetadata: {
curator: req.body.curator.email,
date: Date.now(),
},
},
} as CaseDTO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ describe('Linelist table', function () {
});
cy.visit('/');
cy.visit('/cases');

// We don't need additional library for just one test, we can format date manually
const today = new Date();
const year = today.getFullYear();
const month = today.getMonth() < 9 ? `0${today.getMonth() + 1}` : today.getMonth() + 1;
const day = today.getDate() < 10 ? `0${today.getDate()}` : today.getDate();
cy.contains(`${year}-${month}-${day}`)
cy.contains('test@bar.com');
cy.contains('France');
cy.contains('www.example.com');
cy.contains('2020-05-01');
Expand Down
3 changes: 3 additions & 0 deletions verification/curator-service/ui/src/api/models/Day0Case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,12 @@ export interface RevisionMetadata {
revisionNumber: number;
creationMetadata: {
curator: string;
date?: string;
};
updateMetadata: {
curator: string;
date?: string;
notes?: string;
};
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export const labels = [
'Case ID',
'Verified',
'Date Modified',
'Last Modified By',
'Entry date',
'Reported date',
'Case status',
Expand All @@ -18,6 +20,8 @@ export const labels = [
export const createData = (
caseId: string,
verified: boolean,
dateModified: string,
lastModifiedBy: string,
country: string,
region?: string,
district?: string,
Expand All @@ -35,21 +39,23 @@ export const createData = (
comment?: string,
) => {
return {
age: age || '',
caseId: caseId || '',
dateEntry: dateEntry || '',
dateReported: dateReported || '',
caseStatus: caseStatus || '',
comment: comment || '',
country: country || '',
region: region || '',
dateEntry: dateEntry || '',
dateHospitalization: dateHospitalization || '',
dateModified: dateModified || '',
dateOnset: dateOnset || '',
dateReported: dateReported || '',
district: district || '',
place: place || '',
location: location || '',
age: age || '',
gender: gender || '',
lastModifiedBy: lastModifiedBy || '',
location: location || '',
outcome: outcome || '',
dateHospitalization: dateHospitalization || '',
dateOnset: dateOnset || '',
place: place || '',
region: region || '',
source: source || '',
verified: verified || false,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ const LinelistTable = () => {
return createData(
data._id || '',
!!data.curators?.verifiedBy || false,
renderDate(data.revisionMetadata?.updateMetadata?.date) ||
renderDate(data.revisionMetadata?.creationMetadata?.date) ||
'',
data.revisionMetadata?.updateMetadata?.curator ||
data.revisionMetadata?.creationMetadata?.curator ||
'',
nameCountry(data.location.countryISO3, data.location.country) ||
'-',
data.location.region || '-',
Expand Down Expand Up @@ -386,6 +392,18 @@ const LinelistTable = () => {
>
{row.verified && <VerifiedIcon />}
</TableCell>
<TableCell
align="left"
sx={{ minWidth: 100 }}
>
{row.dateModified}
</TableCell>
<TableCell
align="left"
sx={{ minWidth: 100 }}
>
{row.lastModifiedBy}
</TableCell>
<TableCell
align="left"
sx={{ minWidth: 100 }}
Expand Down

0 comments on commit e2a23ca

Please sign in to comment.