File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1404,13 +1404,15 @@ async function UserRatingChallenge(ratingData, jwt) {
14041404
14051405 // iterate the users completions
14061406 for ( const data of Object . entries ( userProfile . completions ) ) {
1407- const [ index , { id, time } ] = data ; // break down the entry
1407+ const [ index , { id, time } ] = data ; // break down the user completion entry
14081408 const challengeProfile = await ChallengeCollection . findOne ( { _id : SanitizeAlphaNumeric ( id ) } )
14091409
14101410 if ( challengeProfile ) {
1411- // users completions have the challenge id listed as completed
1412- if ( challengeProfile . _id . toString ( ) === SanitizeAlphaNumeric ( id ) ) {
1411+ // check if the challengeID given in the request is contained in the users
1412+ // completion data in the database
1413+ if ( challengeProfile . _id . toString ( ) === challengeID ) {
14131414 console . log ( "[*] User has completed this challenge!" )
1415+ console . log ( challengeProfile )
14141416 completedChallenge = true ;
14151417 break ;
14161418 }
You can’t perform that action at this time.
0 commit comments