/soc/2012/sanket/www-statscollector: c28f96a1c922: [BUG] Handle ...

sanket sanket at soc.pidgin.im
Tue Aug 7 15:40:52 EDT 2012


Changeset: c28f96a1c922ac3b905509dd1a56750c21dd5b57
Author:	 sanket <sanket at soc.pidgin.im>
Date:	 2012-08-07 12:40 +0530
Branch:	 default
URL: http://hg.pidgin.im/soc/2012/sanket/www-statscollector/rev/c28f96a1c922

Description:

[BUG] Handle NULL dates

diffstat:

 pidgin_stats_collector/display/views.py  |  2 +-
 pidgin_stats_collector/media/js/stats.js |  8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diffs (31 lines):

diff --git a/pidgin_stats_collector/display/views.py b/pidgin_stats_collector/display/views.py
--- a/pidgin_stats_collector/display/views.py
+++ b/pidgin_stats_collector/display/views.py
@@ -301,7 +301,7 @@ def process_date(get_dict):
   # Default from and to dates
   for p in req_param:
     if p not in get_dict:
-      return None, None
+      return datetime.datetime(2012, 1, 1), datetime.datetime(2012, 12, 31)
 
   try:
 
diff --git a/pidgin_stats_collector/media/js/stats.js b/pidgin_stats_collector/media/js/stats.js
--- a/pidgin_stats_collector/media/js/stats.js
+++ b/pidgin_stats_collector/media/js/stats.js
@@ -6,9 +6,13 @@
      */
 
     var queries = {};
+    queries['week'] = '*';
+    queries['year'] = '2012';
     $.each(document.location.search.substr(1).split('&'),function(c,q){
-        var i = q.split('=');
-        queries[i[0].toString()] = i[1].toString();
+        if(q){
+            var i = q.split('=');
+            queries[i[0].toString()] = i[1].toString();
+        }
     });
 
     /* Week selector */



More information about the Commits mailing list