diff --git a/CTFd/api/v1/challenges.py b/CTFd/api/v1/challenges.py index cc077e1b25475cd3b68b9f1ace0b6aac25f8eaba..aec69916cf3a267b2b8dc030d7a720500c017acb 100644 --- a/CTFd/api/v1/challenges.py +++ b/CTFd/api/v1/challenges.py @@ -277,11 +277,20 @@ def outgoingPost(request): print("sport_fails " + str(sport_fails)) chal_current_points = 0 + for solve in sport_solves: - chal_current_points += solve.value + try: + chal_current_points += solve.value + except: + print("ERROR calculating sport_solves") + for fail in sport_fails: - chal_current_points += fail.value + try: + chal_current_points += fail.value + except: + print("ERROR calculating sport_fails") + print(chal_current_points) #Put the maximum possible value to stay under max_points diff --git a/CTFd/api/v1/submissions.py b/CTFd/api/v1/submissions.py index 25d8f0f9290bca2f0d34c8555a6cf1ed2c64a8c2..6412ebb1c624d8922c5cb27a5063ccd8b6dbfb72 100644 --- a/CTFd/api/v1/submissions.py +++ b/CTFd/api/v1/submissions.py @@ -207,6 +207,7 @@ class Submission(Resource): ip=submission.ip, provided=submission.provided, date=submission.date, + value=submission.value, ) db.session.add(solve) db.session.delete(submission) diff --git a/CTFd/themes/core-beta/templates/challenges.html b/CTFd/themes/core-beta/templates/challenges.html index dd6a62083aeac4806eed153fa55a524778944542..099bf2978c0542208b0d9e9ba658840046900e38 100644 --- a/CTFd/themes/core-beta/templates/challenges.html +++ b/CTFd/themes/core-beta/templates/challenges.html @@ -166,7 +166,7 @@ <button :style="c.thumbsnail ? 'background-image: url(' + c.thumbsnail + ');' : 'background-color: rgba(33, 37, 41, 1); z-index:10;'" class="challenge-button text-truncate" - :class="c.solved_by_me ? 'challenge-solved' : (c.type === 'sport' || c.type === 'manualRecursive' ? '' : (c.submited ? 'challenge-submited' : ''))" + :class="(c.solved_by_me && c.type !== 'sport' && c.type !== 'manualRecursive') ? 'challenge-solved' : (c.type === 'sport' || c.type === 'manualRecursive' ? '' : (c.submited ? 'challenge-submited' : ''))" :value="c.id" @click="loadChallenge(c.id)" > @@ -182,12 +182,15 @@ <span x-show="c.type === 'sport'" x-text="`${c.value}/${c.max_points} pts`"></span> </div> <template x-if="c.solved_by_me"> - <span x-show="c.type === 'sport'" class="solved-tag" x-text="`${c.unit}`"></span> - <span x-show="c.type === 'manualRecursive'" class="solved-tag" x-text="c.max_attempts"></span> - <span x-show="c.type !== 'sport' && c.type !== 'manualRecursive'" class="solved-tag"></span> + <!--TODO: Rajouter le nombre d'essais/points restants <span x-show="c.type === 'sport'" class="solved-tag" x-text="`${c.unit}`"></span> + <span x-show="c.type === 'manualRecursive'" class="solved-tag" x-text="c.max_attempts"></span> --> + <span x-show="c.type !== 'sport' && c.type !== 'manualRecursive'" class="solved-tag">Complété</span> + </template> + <template x-if="c.type === 'sport' || c.type === 'manualRecursive'"> + <span class="challenge-tag">Récursif</span> </template> <span x-show="c.submited" class="en-validation-tag">En validation</span> - + <template x-if="c.tags.length"> <template x-for="(tag,i) in c.tags"> <template x-if="tag.value == 'Flash'">