@@ -35,6 +35,16 @@ func StandardPrPoints(pr types.ViewPr, username string, now time.Time) *Points {
3535 points := & Points {}
3636 points .Reasons = make ([]string , 0 )
3737
38+ if pr .ThreadsActionable > 0 {
39+ points .Add (80 , fmt .Sprintf ("Someone asked us something, or reacted to our comment (%d comments)" , pr .ThreadsActionable ))
40+ // we already need to go over this, don't scale the points
41+ // by amount of threads though, it might go overboard
42+ }
43+
44+ if pr .ThreadsWaiting > 0 {
45+ points .Remove (10 , fmt .Sprintf ("Someone should respond to our comments (%d comments)" , pr .ThreadsWaiting ))
46+ }
47+
3848 if pr .Author == username {
3949 // our pr
4050 if pr .ReviewStatus == "APPROVED" {
@@ -87,30 +97,26 @@ func StandardPrPoints(pr types.ViewPr, username string, now time.Time) *Points {
8797 }
8898 }
8999
90- // reward short prs
91- diff := int (math .Abs (float64 (pr .Additions )) + math .Abs (float64 (pr .Deletions )))
92- switch {
93- case diff < 50 :
94- points .Add (50 , fmt .Sprintf ("PR is small, %d loc changed is <50" , diff ))
95- case diff < 150 :
96- points .Add (30 , fmt .Sprintf ("PR is smallish, %d loc changed is <150" , diff ))
97- case diff <= 300 :
98- points .Add (20 , fmt .Sprintf ("PR is bigger, %d loc changed is <=300" , diff ))
99- case diff > 300 :
100- points .Add (10 , fmt .Sprintf ("PR is bigish, %d loc changed is >300" , diff ))
100+ // Reward short prs, but only award points to "0 point PRs", i.e.
101+ // everything else matters more (points for "unresponded comments"
102+ // shouldn't have to compete with points for "short PRs").
103+ if points .Total == 0 {
104+ // Sort unreviewed PRs by size, the smallest ones LoC-wise first, so
105+ // that the reviewer gets help to get rid of the smallest tasks.
106+ diff := int (math .Abs (float64 (pr .Additions )) + math .Abs (float64 (pr .Deletions )))
107+ switch {
108+ case diff < 50 :
109+ points .Add (50 , fmt .Sprintf ("PR is small, %d loc changed is <50" , diff ))
110+ case diff < 150 :
111+ points .Add (30 , fmt .Sprintf ("PR is smallish, %d loc changed is <150" , diff ))
112+ case diff <= 300 :
113+ points .Add (20 , fmt .Sprintf ("PR is bigger, %d loc changed is <=300" , diff ))
114+ case diff > 300 :
115+ points .Add (10 , fmt .Sprintf ("PR is bigish, %d loc changed is >300" , diff ))
116+ }
101117 }
102118 }
103119
104- if pr .ThreadsActionable > 0 {
105- points .Add (80 , fmt .Sprintf ("Someone asked us something, or reacted to our comment (%d comments)" , pr .ThreadsActionable ))
106- // we already need to go over this, don't scale the points
107- // by amount of threads though, it might go overboard
108- }
109-
110- if pr .ThreadsWaiting > 0 {
111- points .Remove (10 , fmt .Sprintf ("Someone should respond to our comments (%d comments)" , pr .ThreadsWaiting ))
112- }
113-
114120 sort .Slice (points .Reasons , func (i , j int ) bool {
115121 // render all + points first, then - points
116122 return points .Reasons [i ] < points .Reasons [j ]
0 commit comments