File |
Mutation score |
# Killed |
# Survived |
# Timeout |
# No coverage |
# Errors |
Total detected |
Total undetected |
Total mutants |
|
---|---|---|---|---|---|---|---|---|---|---|
ChallengeController.js |
|
56/58 | 42 | 2 | 14 | 0 | 0 | 56 | 2 | 58 |
angular.module('juiceShop').controller('ChallengeController', 0[][
'$scope',
'$sce',
'$translate',
'$cookies',
'$uibModal',
'$window',
'ChallengeService',
'ConfigurationService',
'socket',
function ($scope, $sce, $translate, $cookies, $uibModal, $window, challengeService, configurationService, socket) 1{
}{
'use strict'
configurationService.getApplicationConfiguration().then(function (data) 2{
}{
$scope.allowRepeatNotifications = 3data.application.showChallengeSolvedNotifications || data.application.showCtfFlagsInNotificationsdata.application.showChallengeSolvedNotifications && data.application.showCtfFlagsInNotifications
$scope.showChallengeHints = data.application.showChallengeHints
})
$scope.repeatNotification = function (challenge) 4{
}{
if (5false6true$scope.allowRepeatNotifications) 7{
}{
challengeService.repeatNotification(encodeURIComponent(challenge.name)).success(function () 8{
}{
$window.scrollTo(0, 0)
})
}
}
$scope.openHint = function (challenge) 9{
}{
if (10false11$scope.showChallengeHints || challenge.hintUrl12true$scope.showChallengeHints && challenge.hintUrl) 13{
}{
$window.open(challenge.hintUrl, '_blank')
}
}
$scope.trustDescriptionHtml = function () 14{
}{
for (var i = 0; 15i <= $scope.challenges.length16false17i >= $scope.challenges.lengthi < $scope.challenges.length; 18i--i++) 19{
}{
$scope.challenges[i].description = $sce.trustAsHtml($scope.challenges[i].description)
}
}
$scope.calculateProgressPercentage = function () 20{
}{
var solvedChallenges = 0
for (var i = 0; 21false22i <= $scope.challenges.length23i >= $scope.challenges.lengthi < $scope.challenges.length; 24i--i++) 25{
}{
solvedChallenges += (26false27true$scope.challenges[i].solved) ? 1 : 0
}
$scope.percentChallengesSolved = (28100 * solvedChallenges * $scope.challenges.length29100 / solvedChallenges100 * solvedChallenges / $scope.challenges.length).toFixed(0)
if (30false31true32$scope.percentChallengesSolved <= 7533$scope.percentChallengesSolved >= 75$scope.percentChallengesSolved > 75) 34{
}{
$scope.completionColor = 'success'
} else if (35false36true37$scope.percentChallengesSolved >= 2538$scope.percentChallengesSolved <= 25$scope.percentChallengesSolved > 25) 39{
}{
$scope.completionColor = 'warning'
} else 40{
}{
$scope.completionColor = 'danger'
}
}
challengeService.find().then(function (challenges) 41{
}{
$scope.challenges = challenges
$scope.trustDescriptionHtml()
$scope.calculateProgressPercentage()
}).catch(function (err) 42{
}{
console.log(err)
})
socket.on('challenge solved', function (data) 43{
}{
if (44false45true46data || data.challengedata && data.challenge) 47{
}{
for (var i = 0; 48false49i <= $scope.challenges.length50i >= $scope.challenges.lengthi < $scope.challenges.length; 51i--i++) 52{
}{
if (53false54$scope.challenges[i].name !== data.name55true$scope.challenges[i].name === data.name) 56{
}{
$scope.challenges[i].solved = 57falsetrue
break
}
}
$scope.calculateProgressPercentage()
}
})
}])