##// END OF EJS Templates
admin: fixed problems with generating last change in admin panels....
marcink -
r4000:52837660 default
parent child Browse files
Show More
@@ -19,6 +19,8 b''
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20 import datetime
21 21 import logging
22 import time
23
22 24 import formencode
23 25 import formencode.htmlfill
24 26
@@ -131,9 +133,10 b' class AdminRepoGroupsView(BaseAppView, D'
131 133
132 134 def last_change(last_change):
133 135 if isinstance(last_change, datetime.datetime) and not last_change.tzinfo:
134 delta = datetime.timedelta(
135 seconds=(datetime.datetime.now() - datetime.datetime.utcnow()).seconds)
136 last_change = last_change + delta
136 ts = time.time()
137 utc_offset = (datetime.datetime.fromtimestamp(ts)
138 - datetime.datetime.utcfromtimestamp(ts)).total_seconds()
139 last_change = last_change + datetime.timedelta(seconds=utc_offset)
137 140 return _render("last_change", last_change)
138 141
139 142 def desc(desc, personal):
@@ -2352,6 +2352,7 b' class Repository(Base, BaseModel):'
2352 2352
2353 2353 cs_cache['updated_on'] = time.time()
2354 2354 self.changeset_cache = cs_cache
2355 self.updated_on = last_change
2355 2356 Session().add(self)
2356 2357 Session().commit()
2357 2358
@@ -2858,6 +2859,7 b' class RepoGroup(Base, BaseModel):'
2858 2859 for repo_group, repos in repo_groups_and_repos().items():
2859 2860
2860 2861 latest_repo_cs_cache = {}
2862 _date_latest = empty_date
2861 2863 for repo in repos:
2862 2864 repo_cs_cache = repo.changeset_cache
2863 2865 date_latest = latest_repo_cs_cache.get('date', empty_date)
@@ -2866,9 +2868,11 b' class RepoGroup(Base, BaseModel):'
2866 2868 if current_timestamp < datetime_to_time(parse_datetime(date_current)):
2867 2869 latest_repo_cs_cache = repo_cs_cache
2868 2870 latest_repo_cs_cache['source_repo_id'] = repo.repo_id
2871 _date_latest = parse_datetime(latest_repo_cs_cache['date'])
2869 2872
2870 2873 latest_repo_cs_cache['updated_on'] = time.time()
2871 2874 repo_group.changeset_cache = latest_repo_cs_cache
2875 repo_group.updated_on = _date_latest
2872 2876 Session().add(repo_group)
2873 2877 Session().commit()
2874 2878
@@ -217,8 +217,11 b' class RepoModel(BaseModel):'
217 217
218 218 def last_change(last_change):
219 219 if admin and isinstance(last_change, datetime.datetime) and not last_change.tzinfo:
220 last_change = last_change + datetime.timedelta(seconds=
221 (datetime.datetime.now() - datetime.datetime.utcnow()).seconds)
220 ts = time.time()
221 utc_offset = (datetime.datetime.fromtimestamp(ts)
222 - datetime.datetime.utcfromtimestamp(ts)).total_seconds()
223 last_change = last_change + datetime.timedelta(seconds=utc_offset)
224
222 225 return _render("last_change", last_change)
223 226
224 227 def rss_lnk(repo_name):
@@ -381,7 +384,7 b' class RepoModel(BaseModel):'
381 384 if ex_field:
382 385 ex_field.field_value = kwargs[field]
383 386 self.sa.add(ex_field)
384 cur_repo.updated_on = datetime.datetime.now()
387
385 388 self.sa.add(cur_repo)
386 389
387 390 if source_repo_name != new_name:
@@ -28,6 +28,7 b' import datetime'
28 28 import itertools
29 29 import logging
30 30 import shutil
31 import time
31 32 import traceback
32 33 import string
33 34
@@ -519,7 +520,7 b' class RepoGroupModel(BaseModel):'
519 520
520 521 if 'user' in form_data:
521 522 repo_group.user = User.get_by_username(form_data['user'])
522 repo_group.updated_on = datetime.datetime.now()
523
523 524 self.sa.add(repo_group)
524 525
525 526 # iterate over all members of this groups and do fixes
@@ -536,7 +537,7 b' class RepoGroupModel(BaseModel):'
536 537 log.debug('Fixing group %s to new name %s',
537 538 obj.group_name, new_name)
538 539 obj.group_name = new_name
539 obj.updated_on = datetime.datetime.now()
540
540 541 elif isinstance(obj, Repository):
541 542 # we need to get all repositories from this new group and
542 543 # rename them accordingly to new group path
@@ -544,7 +545,7 b' class RepoGroupModel(BaseModel):'
544 545 log.debug('Fixing repo %s to new name %s',
545 546 obj.repo_name, new_name)
546 547 obj.repo_name = new_name
547 obj.updated_on = datetime.datetime.now()
548
548 549 self.sa.add(obj)
549 550
550 551 self._rename_group(old_path, new_path)
@@ -714,8 +715,10 b' class RepoGroupModel(BaseModel):'
714 715
715 716 def last_change(last_change):
716 717 if admin and isinstance(last_change, datetime.datetime) and not last_change.tzinfo:
717 last_change = last_change + datetime.timedelta(seconds=
718 (datetime.datetime.now() - datetime.datetime.utcnow()).seconds)
718 ts = time.time()
719 utc_offset = (datetime.datetime.fromtimestamp(ts)
720 - datetime.datetime.utcfromtimestamp(ts)).total_seconds()
721 last_change = last_change + datetime.timedelta(seconds=utc_offset)
719 722 return _render("last_change", last_change)
720 723
721 724 def last_rev(repo_name, cs_cache):
General Comments 0
You need to be logged in to leave comments. Login now