##// END OF EJS Templates
pull requests: add a 'Calculated' comment on current_changeset_status
Mads Kiilerich -
r4053:3625fd19 default
parent child Browse files
Show More
@@ -442,7 +442,7 b' class PullrequestsController(BaseRepoCon'
442 c.comments = cc_model.get_comments(c.rhodecode_db_repo.repo_id,
442 c.comments = cc_model.get_comments(c.rhodecode_db_repo.repo_id,
443 pull_request=pull_request_id)
443 pull_request=pull_request_id)
444
444
445 # changeset(pull-request) status calulation based on reviewers
445 # (badly named) pull-request status calculation based on reviewer votes
446 c.current_changeset_status = cs_model.calculate_status(
446 c.current_changeset_status = cs_model.calculate_status(
447 c.pull_request_reviewers,
447 c.pull_request_reviewers,
448 )
448 )
@@ -64,11 +64,11 b' class ChangesetStatusModel(BaseModel):'
64
64
65 def calculate_status(self, statuses_by_reviewers):
65 def calculate_status(self, statuses_by_reviewers):
66 """
66 """
67 leading one wins, if number of occurrences are equal than weaker wins
67 approved if consensus
68 (old description: leading one wins, if number of occurrences are equal than weaker wins)
68
69
69 :param statuses_by_reviewers:
70 :param statuses_by_reviewers:
70 """
71 """
71 status = None
72 votes = defaultdict(int)
72 votes = defaultdict(int)
73 reviewers_number = len(statuses_by_reviewers)
73 reviewers_number = len(statuses_by_reviewers)
74 for user, statuses in statuses_by_reviewers:
74 for user, statuses in statuses_by_reviewers:
@@ -37,13 +37,13 b''
37 <div class="input">
37 <div class="input">
38 <div class="changeset-status-container" style="float:none;clear:both">
38 <div class="changeset-status-container" style="float:none;clear:both">
39 %if c.current_changeset_status:
39 %if c.current_changeset_status:
40 <div title="${_('Pull request status')}" class="changeset-status-lbl">
40 <div title="${_('Pull request status calculated from votes')}" class="changeset-status-lbl">
41 %if c.pull_request.is_closed():
41 %if c.pull_request.is_closed():
42 ${_('Closed')},
42 ${_('Closed')},
43 %endif
43 %endif
44 ${h.changeset_status_lbl(c.current_changeset_status)}
44 ${h.changeset_status_lbl(c.current_changeset_status)}
45 </div>
45 </div>
46 <div class="changeset-status-ico" style="padding:1px 4px"><img src="${h.url('/images/icons/flag_status_%s.png' % c.current_changeset_status)}" /></div>
46 <div class="changeset-status-ico" style="padding:1px 4px"><img src="${h.url('/images/icons/flag_status_%s.png' % c.current_changeset_status)}" title="${_('Pull request status calculated from votes')}"/></div>
47 %endif
47 %endif
48 </div>
48 </div>
49 </div>
49 </div>
General Comments 0
You need to be logged in to leave comments. Login now