Fixed UI row color bug + Added total org points and row color legends

pull/3/head
Sami Mokaddem 2017-11-08 16:12:42 +01:00
parent 605538ce97
commit 93ce25946d
4 changed files with 41 additions and 17 deletions

View File

@ -67,4 +67,4 @@ regularlyDays=7
2=Is a donator for the MISP project 2=Is a donator for the MISP project
[additionalInfo] [additionalInfo]
textsArray=["Proposals means either edition, acceptation or rejection", "Recent events means event aged of one month at max", "Regularly means at least one per week" ,"Heavily means at least 10 per week", "Classification means correct tagging"] textsArray=["Proposals means either edition, acceptation or rejection", "Recent events means event aged of one month at max", "Regularly means at least one per week" ,"Heavily means at least 10 per week", "Classification means correct tagging", "The contribution rank is set such that it equals to: rank=requirement_fulfilled-requirement_not_fulfilled"]

View File

@ -444,7 +444,7 @@ class Contributor_helper:
to_ret[i] = 0 to_ret[i] = 0
else: else:
to_ret[i] = -1 to_ret[i] = -1
return {'rank': final_rank, 'status': to_ret} return {'rank': final_rank, 'status': to_ret, 'totPoints': random.randint(2**final_rank, 2**self.org_rank_maxLevel*4)}
def TEST_getOrgHonorBadges(self, org): def TEST_getOrgHonorBadges(self, org):
keyname = 'CONTRIB_ORG:{org}:{orgCateg}' keyname = 'CONTRIB_ORG:{org}:{orgCateg}'
@ -455,5 +455,4 @@ class Contributor_helper:
honorBadge.append(1) honorBadge.append(1)
else: else:
honorBadge.append(0) honorBadge.append(0)
print(honorBadge)
return honorBadge return honorBadge

View File

@ -346,7 +346,10 @@ function updateProgressHeader(org) {
// colorize row contribution rank help // colorize row contribution rank help
$.getJSON( url_getContributionOrgStatus+'?org='+org, function( data ) { $.getJSON( url_getContributionOrgStatus+'?org='+org, function( data ) {
var status = data['status']; var status = data['status'];
console.log(data);
var curContributionOrgRank = data['rank']; var curContributionOrgRank = data['rank'];
var totNumPoints = data['totPoints']
$('#orgTotNumOfPoint').text(totNumPoints);
if (curContributionOrgRank == 0) { if (curContributionOrgRank == 0) {
$('#orgContributionRank').attr('data', ''); $('#orgContributionRank').attr('data', '');
} else { } else {
@ -355,21 +358,24 @@ function updateProgressHeader(org) {
for (var row of $('#bodyTablerankingModal')[0].children) { for (var row of $('#bodyTablerankingModal')[0].children) {
row = $(row); row = $(row);
var rank = row.data('rank'); var rank = row.data('rank');
//remove all classes
row.removeClass("warning");
row.removeClass("danger");
row.removeClass("success");
//add correct class
if(status[rank] == 0){ if(status[rank] == 0){
row.addClass("danger"); row.addClass("danger");
} else if(status[rank] == 1) { } else if(status[rank] == 1 && rank == curContributionOrgRank) {
row.addClass("success"); row.addClass("success");
} else { } else if(status[rank] == 1) {
row.removeClass("success"); row.addClass("warning");
row.removeClass("success");
} }
} }
}); });
// colorize badge if acquired
$.getJSON( url_getHonorBadges+'?org='+org, function( data ) { $.getJSON( url_getHonorBadges+'?org='+org, function( data ) {
console.log(data);
for(var i=0; i<data.length; i++) { for(var i=0; i<data.length; i++) {
console.log('#divBadge_'+(i+1));
if (data[i] == 1) { if (data[i] == 1) {
$('#divBadge_'+(i+1)).addClass('circlBadgeAcquired'); $('#divBadge_'+(i+1)).addClass('circlBadgeAcquired');
} else { } else {

View File

@ -50,10 +50,6 @@
<!-- Modal content--> <!-- Modal content-->
<div class="modal-content"> <div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Organisation ranking</h4>
</div>
<div class="modal-body"> <div class="modal-body">
<div class="row"> <div class="row">
<div class="col-lg-4"> <div class="col-lg-4">
@ -85,14 +81,37 @@
</div> </div>
</div> </div>
<div class="col-lg-8"> <div class="col-lg-8">
<h4>Global organisation ranking:</h4> <div class="row">
<div class="col-lg-3">
<h4>Organisation total points: </h4>
</div>
<div class="col-lg-3">
<h4 id='orgTotNumOfPoint'></h4>
</div>
</div>
<div class="row">
<div class="col-lg-3">
<h4>Contribution ranking:</h4>
</div>
<div class="col-lg-6">
<table class="table table-bordered">
<tbody>
<tr>
<td class="success">Current rank</td>
<td class="warning">Requirement satisfied</td>
<td class="danger">Requirement not satisfied</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-bordered"> <table class="table table-striped table-bordered">
<thead> <thead>
<tr> <tr>
<th>Org. rank</th> <th>Contribution rank</th>
<th>Title</th> <th>Title</th>
<th>Points requirement</th> <th>Total points requirement</th>
<th>Contribution requirement</th> <th>Contribution requirement</th>
</tr> </tr>
</thead> </thead>
@ -125,7 +144,7 @@
<img height='64px' width='64px' style="margin-top: 5px;" src="{{ url_for('static', filename='pics/MISPHonorableIcons/1.svg')[:-5]}}{{ item[0] }}.svg" type='image/svg' style="margin: auto;"</img> <img height='64px' width='64px' style="margin-top: 5px;" src="{{ url_for('static', filename='pics/MISPHonorableIcons/1.svg')[:-5]}}{{ item[0] }}.svg" type='image/svg' style="margin: auto;"</img>
</div> </div>
</td> </td>
<td style="padding-left: 10px;">{{ item[1] }}</td> <td style="padding-left: 15px;">{{ item[1] }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>