ui: Restrained number of orgs in fame and prevented datatable to go over

the visible screen
pull/15/head
Sami Mokaddem 2017-12-01 16:02:28 +01:00
parent e4d933a55b
commit d8b7734b08
3 changed files with 11 additions and 10 deletions

View File

@ -458,7 +458,7 @@ class Contributor_helper:
dic['epoch'] = epoch
return dic
def getTopContributorFromRedis(self, date):
def getTopContributorFromRedis(self, date, maxNum=100):
orgDicoPnts = {}
for curDate in util.getMonthSpan(date):
topNum = 0 # all
@ -480,7 +480,7 @@ class Contributor_helper:
data.append(dic)
data.sort(key=lambda x: x['pnts'], reverse=True)
return data
return data[:maxNum]
def getTop5OvertimeFromRedis(self):
data = []

View File

@ -312,7 +312,7 @@ def eventStreamAwards():
yield 'data: {}\n\n'.format(json.dumps(to_return))
@app.route("/_getTopContributor")
def getTopContributor(suppliedDate=None):
def getTopContributor(suppliedDate=None, maxNum=100):
if suppliedDate is None:
try:
date = datetime.datetime.fromtimestamp(float(request.args.get('date')))
@ -321,7 +321,7 @@ def getTopContributor(suppliedDate=None):
else:
date = suppliedDate
data = contributor_helper.getTopContributorFromRedis(date)
data = contributor_helper.getTopContributorFromRedis(date, maxNum=maxNum)
return jsonify(data)
@app.route("/_getFameContributor")
@ -332,7 +332,7 @@ def getFameContributor():
today = datetime.datetime.now()
# get previous month
date = (datetime.datetime(today.year, today.month, 1) - datetime.timedelta(days=1))
return getTopContributor(suppliedDate=date)
return getTopContributor(suppliedDate=date, maxNum=10)
@app.route("/_getFameQualContributor")
def getFameQualContributor():
@ -342,7 +342,7 @@ def getFameQualContributor():
today = datetime.datetime.now()
# get previous month
date = (datetime.datetime(today.year, today.month, 1) - datetime.timedelta(days=1))
return getTopContributor(suppliedDate=date)
return getTopContributor(suppliedDate=date, maxNum=10)
@app.route("/_getTop5Overtime")
def getTop5Overtime():

View File

@ -79,8 +79,9 @@ optionDatatable_last.columnDefs = [
{ className: "centerCellPicOrgLogo verticalAlign", "targets": [ 5 ] },
{ className: "verticalAlign", "targets": [ 6 ] }
]
var optionDatatable_fame = jQuery.extend({}, optionDatatable_light)
optionDatatable_fame.scrollY = '45vh';
var optionDatatable_fameQuant = jQuery.extend({}, optionDatatable_light)
var optionDatatable_fameQual = jQuery.extend({}, optionDatatable_light)
optionDatatable_fameQual.scrollY = '40vh';
var optionDatatable_Categ = {
responsive: true,
@ -590,8 +591,8 @@ $(document).ready(function() {
});
datatableTop = $('#topContribTable').DataTable(optionDatatable_top);
datatableFameQuant = $('#fameTableQuantity').DataTable(optionDatatable_fame);
datatableFameQual = $('#fameTableQuality').DataTable(optionDatatable_fame);
datatableFameQuant = $('#fameTableQuantity').DataTable(optionDatatable_fameQuant);
datatableFameQual = $('#fameTableQuality').DataTable(optionDatatable_fameQual);
datatableCateg = $('#categTable').DataTable(optionDatatable_Categ);
datatableLast = $('#lastTable').DataTable(optionDatatable_last);
datatableAwards = $('#awardTable').DataTable(optionDatatable_awards);