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 <ojeytonwilliams@gmail.com>
pull/38995/head
Kris Koishigawa 2020-06-03 22:11:26 +09:00 committed by Mrugesh Mohapatra
parent 2cfc28915c
commit 89d5c891e3
4 changed files with 104 additions and 26 deletions

View File

@ -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);
}

View File

@ -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 (
<FullWidthRow key={superBlock}>
<Spacer />
<h3>Full Stack Certification</h3>
<h3>Legacy Full Stack Certification</h3>
<div>
<p>
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:
</p>
<ul>
<li>Responsive Web Design</li>
@ -521,7 +519,7 @@ export class CertificationSettings extends Component {
<li>Front End Libraries</li>
<li>Data Visualization</li>
<li>APIs and Microservices</li>
<li>Quality Assurance</li>
<li>Legacy Information Security and Quality Assurance</li>
</ul>
</div>

View File

@ -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"
}

View File

@ -0,0 +1,53 @@
---
id: 561add10cb82ac38a17213bd
title: Full Stack Certificate
challengeType: 7
isHidden: false
isPrivate: true
---
## Description
<section id='description'>
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='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
```
</section>
## Challenge Seed
<section id='challengeSeed'>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>