diff --git a/templates/users.html b/templates/users.html index 85a8442..39a469e 100644 --- a/templates/users.html +++ b/templates/users.html @@ -140,7 +140,7 @@ small {
- Contribution after login (API vs non-API) + Contribution after login Dates: @@ -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, diff --git a/users_helper.py b/users_helper.py index 193d32b..b646e4c 100644 --- a/users_helper.py +++ b/users_helper.py @@ -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: