From 89d5c891e36916e49ecf9d4df96e73a99aaf1021 Mon Sep 17 00:00:00 2001 From: Kris Koishigawa Date: Wed, 3 Jun 2020 22:11:26 +0900 Subject: [PATCH] feat(learn): add full stack certificate md and handle errors Co-authored-by: Mrugesh Mohapatra <1884376+raisedadead@users.noreply.github.com> Co-authored-by: Oliver Eyton-Williams --- api-server/server/boot/certificate.js | 47 +++++++++------- .../src/components/settings/Certification.js | 12 ++--- .../_meta/full-stack-certificate/meta.json | 18 +++++++ .../full-stack-certificate.english.md | 53 +++++++++++++++++++ 4 files changed, 104 insertions(+), 26 deletions(-) create mode 100644 curriculum/challenges/_meta/full-stack-certificate/meta.json create mode 100644 curriculum/challenges/english/12-certificates/full-stack-certificate/full-stack-certificate.english.md diff --git a/api-server/server/boot/certificate.js b/api-server/server/boot/certificate.js index bd881eceec..d17d3a645a 100644 --- a/api-server/server/boot/certificate.js +++ b/api-server/server/boot/certificate.js @@ -6,6 +6,7 @@ import { Observable } from 'rx'; import debug from 'debug'; import { isEmail } from 'validator'; import format from 'date-fns/format'; +import { reportError } from '../middlewares/sentry-error-handler.js'; import { ifNoUser401 } from '../utils/middleware'; import { observeQuery } from '../utils/rx'; @@ -78,6 +79,12 @@ const successMessage = (username, name) => dedent` Congratulations on behalf of the freeCodeCamp.org team! `; +const failureMessage = name => dedent` + Something went wrong with the verification of ${name}, please try again. + If you continue to receive this error, you can send a message to + support@freeCodeCamp.org to get help. + `; + function ifNoSuperBlock404(req, res, next) { const { superBlock } = req.body; if (superBlock && superBlocks.includes(superBlock)) { @@ -302,27 +309,29 @@ function createVerifyCert(certTypeIds, app) { [certType]: true }; - if (challenge) { - const { id, tests, challengeType } = challenge; - if ( - !user[certType] && - !isCertified(tests, user.completedChallenges) - ) { - return Observable.just(notCertifiedMessage(certName)); - } - updateData = { - ...updateData, - completedChallenges: [ - ...user.completedChallenges, - { - id, - completedDate: new Date(), - challengeType - } - ] - }; + // certificate doesn't exist or + // connection error + if (!challenge) { + reportError(`Error claiming ${certName}`); + return Observable.just(failureMessage(certName)); } + const { id, tests, challengeType } = challenge; + if (!user[certType] && !isCertified(tests, user.completedChallenges)) { + return Observable.just(notCertifiedMessage(certName)); + } + updateData = { + ...updateData, + completedChallenges: [ + ...user.completedChallenges, + { + id, + completedDate: new Date(), + challengeType + } + ] + }; + if (!user.name) { return Observable.just(noNameMessage); } diff --git a/client/src/components/settings/Certification.js b/client/src/components/settings/Certification.js index 58cebd10e1..c99ea8fc7e 100644 --- a/client/src/components/settings/Certification.js +++ b/client/src/components/settings/Certification.js @@ -472,8 +472,7 @@ export class CertificationSettings extends Component { is2018DataVisCert, isApisMicroservicesCert, isFrontEndLibsCert, - is2020QaCert, - is2020InfosecCert, + isInfosecQaCert, isJsAlgoDataStructCert, isRespWebDesignCert } = this.props; @@ -482,8 +481,7 @@ export class CertificationSettings extends Component { is2018DataVisCert && isApisMicroservicesCert && isFrontEndLibsCert && - is2020QaCert && - is2020InfosecCert && + isInfosecQaCert && isJsAlgoDataStructCert && isRespWebDesignCert; @@ -509,11 +507,11 @@ export class CertificationSettings extends Component { return ( -

Full Stack Certification

+

Legacy Full Stack Certification

Once you've earned the following freeCodeCamp certifications, you'll - be able to claim The Full Stack Developer Certification: + be able to claim the Legacy Full Stack Developer Certification:

  • Responsive Web Design
  • @@ -521,7 +519,7 @@ export class CertificationSettings extends Component {
  • Front End Libraries
  • Data Visualization
  • APIs and Microservices
  • -
  • Quality Assurance
  • +
  • Legacy Information Security and Quality Assurance
diff --git a/curriculum/challenges/_meta/full-stack-certificate/meta.json b/curriculum/challenges/_meta/full-stack-certificate/meta.json new file mode 100644 index 0000000000..58469fde97 --- /dev/null +++ b/curriculum/challenges/_meta/full-stack-certificate/meta.json @@ -0,0 +1,18 @@ +{ + "name": "Full Stack Certificate", + "dashedName": "full-stack-certificate", + "order": 5, + "time": "", + "template": "", + "required": [], + "superBlock": "certificates", + "superOrder": 12, + "challengeOrder": [ + [ + "561add10cb82ac38a17213bd", + "Full Stack Certificate" + ] + ], + "isPrivate": true, + "fileName": "12-certificates/full-stack-certificate.json" +} diff --git a/curriculum/challenges/english/12-certificates/full-stack-certificate/full-stack-certificate.english.md b/curriculum/challenges/english/12-certificates/full-stack-certificate/full-stack-certificate.english.md new file mode 100644 index 0000000000..6826f02679 --- /dev/null +++ b/curriculum/challenges/english/12-certificates/full-stack-certificate/full-stack-certificate.english.md @@ -0,0 +1,53 @@ +--- +id: 561add10cb82ac38a17213bd +title: Full Stack Certificate +challengeType: 7 +isHidden: false +isPrivate: true +--- + +## Description +
+ +
+ +## Instructions +
+ +
+ +## Tests +
+ +```yml +tests: + - id: 561add10cb82ac38a17513bc + title: Responsive Web Design Certificate + - id: 561abd10cb81ac38a17513bc + title: JavaScript Algorithms and Data Structures Certificate + - id: 561acd10cb82ac38a17513bc + title: Front End Libraries Certificate + - id: 5a553ca864b52e1d8bceea14 + title: Data Visualization Certificate + - id: 561add10cb82ac38a17523bc + title: API's and Microservices Certificate + - id: 561add10cb82ac38a17213bc + title: Legacy Information Security and Quality Assurance Certificate + +``` + +
+ +## Challenge Seed +
+ +
+ +## Solution +
+ +```js +// solution required +``` + +