fix: correct cert date for legacy data visualization (#35728)
Closes #34890 Closes #17424
This commit is contained in:
committed by
mrugesh mohapatra
parent
e5d0597f3e
commit
b4d3e6d6bb
@ -430,8 +430,25 @@ function createShowCert(app) {
|
|||||||
|
|
||||||
if (user[certType]) {
|
if (user[certType]) {
|
||||||
const { completedChallenges = [] } = user;
|
const { completedChallenges = [] } = user;
|
||||||
const { completedDate = new Date() } =
|
const certChallenge = _.find(
|
||||||
_.find(completedChallenges, ({ id }) => certId === id) || {};
|
completedChallenges,
|
||||||
|
({ id }) => certId === id
|
||||||
|
);
|
||||||
|
let { completedDate = new Date() } = certChallenge || {};
|
||||||
|
|
||||||
|
// the challange id has been rotated for isDataVisCert
|
||||||
|
// so we need to check for id 561add10cb82ac38a17513b3
|
||||||
|
if (certType === 'isDataVisCert' && !certChallenge) {
|
||||||
|
console.log('olderId');
|
||||||
|
let oldDataVisIdChall = _.find(
|
||||||
|
completedChallenges,
|
||||||
|
({ id }) => '561add10cb82ac38a17513b3' === id
|
||||||
|
);
|
||||||
|
|
||||||
|
if (oldDataVisIdChall) {
|
||||||
|
completedDate = oldDataVisIdChall.completedDate || completedDate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const { username, name } = user;
|
const { username, name } = user;
|
||||||
return res.json({
|
return res.json({
|
||||||
|
Reference in New Issue
Block a user