Added no data display in contribution_after_login

pull/8/head
Sami Mokaddem 2017-11-15 14:43:28 +01:00
parent 05c7c7a453
commit 66fe81b064
2 changed files with 7 additions and 5 deletions

View File

@ -140,7 +140,7 @@ small {
<div class="panel panel-default" style="">
<div class="panel-heading bg-info" style="font-weight: bold;">
<b>Contribution after login (API vs non-API)</b>
<b>Contribution after login</b>
<strong class='leftSepa textTopHeader' style="float: none; padding: 11px;">Dates:
<input type="text" id="datepickerApi" size="10" style="">
</strong>
@ -250,16 +250,19 @@ small {
function updateDatePieApi() {
var date = datePickerWidgetApi.datepicker( "getDate" );
$.getJSON( "{{ url_for('getLoginVSCOntribution') }}"+"?date="+date.getTime()/1000, function( data ) {
data = [
toPlot = [
{label: 'Has contributed during the day', data: data[0], color: '#4da74d' },
{label: 'Has not contributed during the day', data:data[1], color: '#cb4b4b' }
]
];
if (data[0] == 0 && data[1] == 0) {
toPlot = [{ label: 'No data', data: 100 }];
}
if (!pieApiWidget === undefined) {
pieApiWidget.setData(toPlot);
pieApiWidget.draw();
} else {
pieApiWidget = $.plot('#pieApi', data, {
pieApiWidget = $.plot('#pieApi', toPlot, {
series: {
pie: {
innerRadius: 0.5,

View File

@ -37,7 +37,6 @@ class Users_helper:
orgs_contri = self.serv_redis_db.zrange(keyname, 0, -1, desc=True, withscores=False)
orgs_contri = [ org.decode('utf8') for org in orgs_contri ]
orgs_login = [ org[0] for org in self.getTopOrglogin(date, topNum=0) ]
contributed_num = 0
non_contributed_num = 0
for org in orgs_login: