Skip to content

Commit

Permalink
fix: estimate review time unknown file extension edge case (#115)
Browse files Browse the repository at this point in the history
* fix: overshadowed variable estimate

Fix variable estimate not getting set correctly if the file extension is
unknown

* fix: edge case when estimated time is 0 seconds

Fix label not getting set correctly when estimated time is 0 seconds
  • Loading branch information
tnevrlka authored Mar 18, 2024
1 parent 142df51 commit 31c066e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmd/estimate/reviewTime.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ func estimateFileTimes(files []*github.CommitFile) int {
}
estimate, included := config.Extensions[extension]
if !included {
estimate, defaultIncluded := config.Extensions["default"]
var defaultIncluded bool
estimate, defaultIncluded = config.Extensions["default"]
if !defaultIncluded {
estimate = defaultExtensionWeight
}
Expand Down Expand Up @@ -228,7 +229,7 @@ func getLabelBasedOnTime(reviewTime int) (*TimeLabel, error) {
}
maxLabel := TimeLabel{Time: -1}
for _, label := range config.Labels {
if label.Time < reviewTime && label.Time > maxLabel.Time {
if label.Time <= reviewTime && label.Time > maxLabel.Time {
maxLabel = label
}
}
Expand Down

0 comments on commit 31c066e

Please sign in to comment.