Skip to content

Commit

Permalink
flag a user if they have access to a scorer by dint of it already bei…
Browse files Browse the repository at this point in the history
…ng assigned, but otherwise don't have it shared with them...
  • Loading branch information
epugh committed Dec 11, 2023
1 parent ce7bf25 commit 7bb103d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
1 change: 0 additions & 1 deletion app/assets/javascripts/controllers/queriesCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ angular.module('QuepidApp')
function pickCaseScorer() {
var modalInstance = $uibModal.open({
templateUrl: 'views/pick_scorer.html',
backdrop: 'static',
controller: 'ScorerCtrl',
resolve: {
parent: function() {
Expand Down
20 changes: 18 additions & 2 deletions app/assets/javascripts/controllers/scorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,21 @@ angular.module('QuepidApp')
$scope.gotoScorers = gotoScorers;
$scope.ok = ok;
$scope.scorers = [];
$scope.communalScorers = [];
$scope.communalScorers = [];
$scope.selectScorer = selectScorer;
$scope.usingDefaultScorer = usingDefaultScorer;
$scope.communalScorersOnly = configurationSvc.isCommunalScorersOnly();

if ($scope.activeScorer.scorerId && ($scope.activeScorer.scorerId !== 'default')) {
$scope.activeScorer.scorerId = parseInt($scope.activeScorer.scorerId);
}

/*jslint latedef:false*/
scorerSvc.list()
.then(function() {
$scope.userScorers = scorerSvc.scorers;
$scope.communalScorers = scorerSvc.communalScorers;
$scope.scorerAccessible = scorerAccessible();
});

function cancel() {
Expand All @@ -48,6 +49,21 @@ angular.module('QuepidApp')

$uibModalInstance.close($scope.activeScorer);
}

function scorerAccessible() {
let scorerAccessible = false;

if ($scope.activeScorer.scorerId) {
angular.forEach($scope.userScorers.concat($scope.communalScorers), function (scorer){
if (scorer.scorerId === $scope.activeScorer.scorerId){
scorerAccessible = true;
return scorerAccessible;
}
});
}
return scorerAccessible;

}

function selectScorer(scorer) {
var name = (!scorer ? 'none' : scorer.name);
Expand Down
3 changes: 3 additions & 0 deletions app/assets/templates/views/pick_scorer.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<h3 class="modal-title">How would you like to score this case?</h3>
</div>
<div class="modal-body">
<div ng-if="!scorerAccessible" class="alert alert-warning" role="alert">
The scorer {{activeScorer.name}} used by this case is NOT shared via a team with you, so if you switch away from it you won't have access to it again.
</div>
<div class="row" style="max-height:300px;overflow-y:auto">
<h4>Select from defaults:</h4>
<ul class="list-group">
Expand Down

0 comments on commit 7bb103d

Please sign in to comment.