Skip to content

Commit

Permalink
[#3373]Dashboard_mark_activities_old is set to utcnow() format
Browse files Browse the repository at this point in the history
The problem was that dashboard_mark_activities_old method was not changed to utcnow() format, so when datasets were updated, because of the time difference, user have seen them before he actually entered the page.

I've adde utcnow() format for this method and now the time works fine. Also added untnow() to Dashboard model, so the time can be saved correctly.
  • Loading branch information
Yan authored and amercader committed Feb 14, 2017
1 parent 442bd46 commit 2166f7a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ckan/logic/action/update.py
Expand Up @@ -1134,7 +1134,7 @@ def dashboard_mark_activities_old(context, data_dict):
model = context['model']
user_id = model.User.get(context['user']).id
model.Dashboard.get(user_id).activity_stream_last_viewed = (
datetime.datetime.now())
datetime.datetime.utcnow())
if not context.get('defer_commit'):
model.repo.commit()

Expand Down
4 changes: 2 additions & 2 deletions ckan/model/dashboard.py
Expand Up @@ -19,8 +19,8 @@ class Dashboard(object):

def __init__(self, user_id):
self.user_id = user_id
self.activity_stream_last_viewed = datetime.datetime.now()
self.email_last_sent = datetime.datetime.now()
self.activity_stream_last_viewed = datetime.datetime.utcnow()
self.email_last_sent = datetime.datetime.utcnow()

@classmethod
def get(cls, user_id):
Expand Down

0 comments on commit 2166f7a

Please sign in to comment.