Added support of previous date from getCategPerContrib

pull/3/head
Sami Mokaddem 2017-11-10 09:00:50 +01:00
parent 1725f0b519
commit b0a83a9ebd
2 changed files with 13 additions and 16 deletions

View File

@ -310,24 +310,20 @@ class Contributor_helper:
def getCategPerContribFromRedis(self, date):
keyCateg = "CONTRIB_DAY"
topNum = 0 # all
contrib_org = self.getZrange(keyCateg, date, topNum)
data = []
for org, pnts in contrib_org:
dic = {}
dic['rank'] = self.getTrueRank(pnts)
dic['orgRank'] = self.getOrgContributionRank(org)['final_rank']
dic['honorBadge'] = self.getOrgHonorBadges(org)
dic['logo_path'] = self.getOrgLogoFromMISP(org)
dic['org'] = org
dic['pnts'] = pnts
contrib_org = self.getTopContributorFromRedis(date)
for dic in contrib_org:
org = dic['org']
for categ in self.categories_in_datatable:
keyname = 'CONTRIB_CATEG:'+util.getDateStrFormat(date)+':'+categ
categ_score = self.serv_redis_db.zscore(keyname, org)
if categ_score is None:
categ_score = 0
dic[categ] = categ_score
data.append(dic)
return data
for curDate in util.getMonthSpan(date):
keyname = 'CONTRIB_CATEG:'+util.getDateStrFormat(curDate)+':'+categ
temp = self.serv_redis_db.zscore(keyname, org)
if temp is None:
temp = 0
categ_score += temp
dic[categ] = categ_score
return contrib_org
def getAllOrgFromRedis(self):
data = self.serv_redis_db.smembers('CONTRIB_ALL_ORG')

View File

@ -82,6 +82,7 @@ optionDatatable_fame.scrollY = '45vh';
var optionDatatable_Categ = {
responsive: true,
searching: true,
"order": [[ 0, "desc" ]],
scrollY: '38vh',
"scrollX": true,
scrollCollapse: true,