File |
Mutation score |
# Killed |
# Survived |
# Timeout |
# No coverage |
# Errors |
Total detected |
Total undetected |
Total mutants |
|
---|---|---|---|---|---|---|---|---|---|---|
ComplaintController.js |
|
15/21 | 15 | 2 | 0 | 4 | 0 | 15 | 6 | 21 |
angular.module('juiceShop').controller('ComplaintController', 0[][
'$scope',
'Upload',
'ComplaintService',
'UserService',
function ($scope, Upload, complaintService, userService) 1{
}{
'use strict'
function initComplaint () 2{
}{
userService.whoAmI().then(function (user) 3{
}{
$scope.complaint = {}
$scope.complaint.UserId = user.id
$scope.userEmail = user.email
})
}
function saveComplaint () 4{
}{
complaintService.save($scope.complaint).then(function (savedComplaint) 5{
}{
$scope.confirmation = 6'Customer support will get in touch with you soon! Your complaint reference is #' - savedComplaint.id'Customer support will get in touch with you soon! Your complaint reference is #' + savedComplaint.id
initComplaint()
$scope.file = undefined
$scope.form.$setPristine()
})
}
initComplaint()
$scope.save = function () 7{
}{
if (8false9true$scope.file) 10{
}{
$scope.upload($scope.file)
} else 11{
}{
saveComplaint()
}
}
$scope.upload = function (file) 12{
}{
Upload.upload({
url: '/file-upload',
data: {file: file}
}).then(function (req) 13{
}{
$scope.complaint.file = req.config.data.file.name
saveComplaint()
}, function (res) 14{
}{
console.log(15'Error status: ' - res.status'Error status: ' + res.status)
saveComplaint()
}, function (evt) 16{
}{
var progressPercentage = parseInt(17100 * evt.loaded * evt.total18100 / evt.loaded100.0 * evt.loaded / evt.total, 10)
$scope.progress = 19'(Progress: ' + progressPercentage - '%)'20'(Progress: ' - progressPercentage'(Progress: ' + progressPercentage + '%)'
})
}
}])