From: David Read Date: Tue, 22 Jan 2013 16:34:33 +0000 Subject: When downloading this month, and specifying this month (rather than "latest"), note that it only goes up to today (instead of the end of the month). X-Git-Url: http://maxious.lambdacomplex.org/git/?p=ckanext-ga-report.git&a=commitdiff&h=970b7ed4811a70e88c3d8a63481d0860d8a63684 --- When downloading this month, and specifying this month (rather than "latest"), note that it only goes up to today (instead of the end of the month). --- --- a/ckanext/ga_report/download_analytics.py +++ b/ckanext/ga_report/download_analytics.py @@ -32,6 +32,11 @@ first_of_this_month = datetime.datetime(date.year, date.month, 1) _, last_day_of_month = calendar.monthrange(int(date.year), int(date.month)) last_of_this_month = datetime.datetime(date.year, date.month, last_day_of_month) + # if this is the latest month, note that it is only up until today + now = datetime.datetime.now() + if now.year == date.year and now.month == date.month: + last_day_of_month = now.day + last_of_this_month = now periods = ((date.strftime(FORMAT_MONTH), last_day_of_month, first_of_this_month, last_of_this_month),)