diff --git a/config/ranking.cfg b/config/ranking.cfg index b0119fb..647fc90 100644 --- a/config/ranking.cfg +++ b/config/ranking.cfg @@ -67,4 +67,4 @@ regularlyDays=7 2=Is a donator for the MISP project [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"] diff --git a/contributor_helper.py b/contributor_helper.py index ee1cad4..33f180c 100644 --- a/contributor_helper.py +++ b/contributor_helper.py @@ -444,7 +444,7 @@ class Contributor_helper: to_ret[i] = 0 else: 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): keyname = 'CONTRIB_ORG:{org}:{orgCateg}' @@ -455,5 +455,4 @@ class Contributor_helper: honorBadge.append(1) else: honorBadge.append(0) - print(honorBadge) return honorBadge diff --git a/static/js/contrib.js b/static/js/contrib.js index f75cb2d..b16c897 100644 --- a/static/js/contrib.js +++ b/static/js/contrib.js @@ -346,7 +346,10 @@ function updateProgressHeader(org) { // colorize row contribution rank help $.getJSON( url_getContributionOrgStatus+'?org='+org, function( data ) { var status = data['status']; + console.log(data); var curContributionOrgRank = data['rank']; + var totNumPoints = data['totPoints'] + $('#orgTotNumOfPoint').text(totNumPoints); if (curContributionOrgRank == 0) { $('#orgContributionRank').attr('data', ''); } else { @@ -355,21 +358,24 @@ function updateProgressHeader(org) { for (var row of $('#bodyTablerankingModal')[0].children) { row = $(row); var rank = row.data('rank'); + //remove all classes + row.removeClass("warning"); + row.removeClass("danger"); + row.removeClass("success"); + //add correct class if(status[rank] == 0){ row.addClass("danger"); - } else if(status[rank] == 1) { + } else if(status[rank] == 1 && rank == curContributionOrgRank) { row.addClass("success"); - } else { - row.removeClass("success"); - row.removeClass("success"); + } else if(status[rank] == 1) { + row.addClass("warning"); } } }); + // colorize badge if acquired $.getJSON( url_getHonorBadges+'?org='+org, function( data ) { - console.log(data); for(var i=0; i