feat: display multifile projects (#45220)
* refactor: DRY up certification and ProjectModal * fix: use sensible keys for SolutionViewer * refactor: handle legacy solutions like new ones * refactor: correct CompletedChallenge type * fix: store challengeType for multifile projects * fix: use challengeType to set display type * feat: use dropdown to display project + code * refactor: isOpen -> showCode to avoid a clash We need to be able both show the code and show the completed project * refactor: remove redundant parts of projectPreview * refactor: fix project preview types * feat: wip, using existing modal to show project * feat: show projects on timeline * feat: display projects on time-line * chore: use consistent case for GitHub * fix(a11y): translate show solution/view * refactor: rename showFilesSolution * refactor: use self-closing tag * fix: remove hardcoding (certification + timeline) * fix: remove hardcoding (settings) * test: supply store and mock ga * fix: include challengeType for projects Co-authored-by: Tom <20648924+moT01@users.noreply.github.com> * refactor: remove space Co-authored-by: Tom <20648924+moT01@users.noreply.github.com> * fix: key -> filekey on challenge submission * fix: handle submissions without files Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
d1d04dbadf
commit
c11bd163b2
@@ -239,17 +239,30 @@ export function modernChallengeCompleted(req, res, next) {
|
||||
const completedDate = Date.now();
|
||||
const { id, files, challengeType } = req.body;
|
||||
|
||||
const data = {
|
||||
const completedChallenge = {
|
||||
id,
|
||||
files,
|
||||
completedDate
|
||||
};
|
||||
|
||||
if (challengeType === 14) {
|
||||
data.isManuallyApproved = false;
|
||||
completedChallenge.isManuallyApproved = false;
|
||||
}
|
||||
|
||||
const { alreadyCompleted, updateData } = buildUserUpdate(user, id, data);
|
||||
// We only need to know the challenge type if it's a project. If it's a
|
||||
// step or normal challenge we can avoid storing in the database.
|
||||
if (
|
||||
jsCertProjectIds.includes(id) ||
|
||||
multiFileCertProjectIds.includes(id)
|
||||
) {
|
||||
completedChallenge.challengeType = challengeType;
|
||||
}
|
||||
|
||||
const { alreadyCompleted, updateData } = buildUserUpdate(
|
||||
user,
|
||||
id,
|
||||
completedChallenge
|
||||
);
|
||||
const points = alreadyCompleted ? user.points : user.points + 1;
|
||||
const updatePromise = new Promise((resolve, reject) =>
|
||||
user.updateAttributes(updateData, err => {
|
||||
|
Reference in New Issue
Block a user