Show More
@@ -141,6 +141,20 b' class ReposController(BaseController):' | |||
|
141 | 141 | |
|
142 | 142 | except formencode.Invalid, errors: |
|
143 | 143 | c.repo_info = repo_model.get_by_repo_name(repo_name) |
|
144 | if c.repo_info.stats: | |
|
145 | last_rev = c.repo_info.stats.stat_on_revision | |
|
146 | else: | |
|
147 | last_rev = 0 | |
|
148 | c.stats_revision = last_rev | |
|
149 | r = ScmModel().get(repo_name) | |
|
150 | c.repo_last_rev = r.revisions[-1] if r.revisions else 0 | |
|
151 | ||
|
152 | if last_rev == 0: | |
|
153 | c.stats_percentage = 0 | |
|
154 | else: | |
|
155 | c.stats_percentage = '%.2f' % ((float((last_rev)) / | |
|
156 | c.repo_last_rev) * 100) | |
|
157 | ||
|
144 | 158 | c.users_array = repo_model.get_users_js() |
|
145 | 159 | errors.value.update({'user':c.repo_info.user.username}) |
|
146 | 160 | return htmlfill.render( |
@@ -245,9 +259,9 b' class ReposController(BaseController):' | |||
|
245 | 259 | """GET /repos/repo_name/edit: Form to edit an existing item""" |
|
246 | 260 | # url('edit_repo', repo_name=ID) |
|
247 | 261 | repo_model = RepoModel() |
|
248 |
c.repo_info |
|
|
249 | if repo.stats: | |
|
250 | last_rev = repo.stats.stat_on_revision | |
|
262 | c.repo_info = repo_model.get_by_repo_name(repo_name) | |
|
263 | if c.repo_info.stats: | |
|
264 | last_rev = c.repo_info.stats.stat_on_revision | |
|
251 | 265 | else: |
|
252 | 266 | last_rev = 0 |
|
253 | 267 | c.stats_revision = last_rev |
@@ -257,10 +271,11 b' class ReposController(BaseController):' | |||
|
257 | 271 | if last_rev == 0: |
|
258 | 272 | c.stats_percentage = 0 |
|
259 | 273 | else: |
|
260 |
c.stats_percentage = '%.2f' % ((float((last_rev)) / |
|
|
274 | c.stats_percentage = '%.2f' % ((float((last_rev)) / | |
|
275 | c.repo_last_rev) * 100) | |
|
261 | 276 | |
|
262 | 277 | |
|
263 | if not repo: | |
|
278 | if not c.repo_info: | |
|
264 | 279 | h.flash(_('%s repository is not mapped to db perhaps' |
|
265 | 280 | ' it was created or renamed from the filesystem' |
|
266 | 281 | ' please run the application again' |
@@ -4,6 +4,7 b'' | |||
|
4 | 4 | ~~~~~~~~~~~~~~ |
|
5 | 5 | |
|
6 | 6 | Summary controller for Rhodecode |
|
7 | ||
|
7 | 8 | :created_on: Apr 18, 2010 |
|
8 | 9 | :author: marcink |
|
9 | 10 | :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> |
@@ -114,7 +115,7 b' class SummaryController(BaseController):' | |||
|
114 | 115 | c.no_data_msg = _('No data loaded yet') |
|
115 | 116 | run_task(get_commits_stats, c.repo_info.name, ts_min_y, ts_max_y) |
|
116 | 117 | else: |
|
117 | c.no_data_msg = _('Statistics are disabled for this repository') | |
|
118 | c.no_data_msg = _('Statistics update are disabled for this repository') | |
|
118 | 119 | c.ts_min = ts_min_m |
|
119 | 120 | c.ts_max = ts_max_y |
|
120 | 121 | |
@@ -124,7 +125,7 b' class SummaryController(BaseController):' | |||
|
124 | 125 | |
|
125 | 126 | |
|
126 | 127 | if stats and stats.languages: |
|
127 | c.no_data = False | |
|
128 | c.no_data = False is c.repo_info.dbrepo.enable_statistics | |
|
128 | 129 | lang_stats = json.loads(stats.languages) |
|
129 | 130 | c.commit_data = stats.commit_activity |
|
130 | 131 | c.overview_data = stats.commit_activity_combined |
@@ -75,38 +75,36 b' class RepoModel(BaseModel):' | |||
|
75 | 75 | |
|
76 | 76 | def update(self, repo_name, form_data): |
|
77 | 77 | try: |
|
78 | cur_repo = self.get_by_repo_name(repo_name, cache=False) | |
|
79 | user_model = UserModel(self.sa) | |
|
78 | 80 | |
|
79 | 81 | #update permissions |
|
80 | 82 | for username, perm in form_data['perms_updates']: |
|
81 | 83 | r2p = self.sa.query(RepoToPerm)\ |
|
82 |
.filter(RepoToPerm.user == |
|
|
83 | .get_by_username(username, cache=False))\ | |
|
84 | .filter(RepoToPerm.repository == \ | |
|
85 | self.get_by_repo_name(repo_name))\ | |
|
84 | .filter(RepoToPerm.user == user_model.get_by_username(username))\ | |
|
85 | .filter(RepoToPerm.repository == cur_repo)\ | |
|
86 | 86 | .one() |
|
87 | 87 | |
|
88 |
r2p.permission |
|
|
89 |
|
|
|
90 |
|
|
|
88 | r2p.permission = self.sa.query(Permission)\ | |
|
89 | .filter(Permission.permission_name == perm)\ | |
|
90 | .scalar() | |
|
91 | 91 | self.sa.add(r2p) |
|
92 | 92 | |
|
93 | 93 | #set new permissions |
|
94 | 94 | for username, perm in form_data['perms_new']: |
|
95 | 95 | r2p = RepoToPerm() |
|
96 |
r2p.repository = |
|
|
97 |
r2p.user = |
|
|
96 | r2p.repository = cur_repo | |
|
97 | r2p.user = user_model.get_by_username(username, cache=False) | |
|
98 | 98 | |
|
99 |
r2p.permission |
|
|
100 |
|
|
|
101 |
|
|
|
99 | r2p.permission = self.sa.query(Permission)\ | |
|
100 | .filter(Permission.permission_name == perm)\ | |
|
101 | .scalar() | |
|
102 | 102 | self.sa.add(r2p) |
|
103 | 103 | |
|
104 | 104 | #update current repo |
|
105 | cur_repo = self.get_by_repo_name(repo_name, cache=False) | |
|
106 | ||
|
107 | 105 | for k, v in form_data.items(): |
|
108 | 106 | if k == 'user': |
|
109 |
cur_repo.user |
|
|
107 | cur_repo.user = user_model.get(v) | |
|
110 | 108 | else: |
|
111 | 109 | setattr(cur_repo, k, v) |
|
112 | 110 |
@@ -619,7 +619,7 b'' | |||
|
619 | 619 | </div> |
|
620 | 620 | <div class="box"> |
|
621 | 621 | <div class="title"> |
|
622 |
<div class="breadcrumbs">${h.link_to(_(' |
|
|
622 | <div class="breadcrumbs">${h.link_to(_('Tags'),h.url('tags_home',repo_name=c.repo_name))}</div> | |
|
623 | 623 | </div> |
|
624 | 624 | <div class="table"> |
|
625 | 625 | <%include file='../tags/tags_data.html'/> |
@@ -630,7 +630,7 b'' | |||
|
630 | 630 | </div> |
|
631 | 631 | <div class="box"> |
|
632 | 632 | <div class="title"> |
|
633 |
<div class="breadcrumbs">${h.link_to(_(' |
|
|
633 | <div class="breadcrumbs">${h.link_to(_('Branches'),h.url('branches_home',repo_name=c.repo_name))}</div> | |
|
634 | 634 | </div> |
|
635 | 635 | <div class="table"> |
|
636 | 636 | <%include file='../branches/branches_data.html'/> |
General Comments 0
You need to be logged in to leave comments.
Login now