aboutsummaryrefslogtreecommitdiffstats
path: root/internal/chore
diff options
context:
space:
mode:
authorLibravatar Mo Tarbin <mhed.t91@gmail.com>2024-07-22 18:43:14 -0400
committerLibravatar Mo Tarbin <mhed.t91@gmail.com>2024-07-22 18:43:14 -0400
commit862b8c925277e78bd7ecbe0d4d142ba48dc97bc9 (patch)
treeb54e3e38c38e76e83083e3d537ae68acd041e733 /internal/chore
parent1c415745a8bde532c3f668f7833019120ca89292 (diff)
parent31211a9436b7073ee054cbc091ce684a9051efec (diff)
downloaddonetick-862b8c925277e78bd7ecbe0d4d142ba48dc97bc9.tar.gz
donetick-862b8c925277e78bd7ecbe0d4d142ba48dc97bc9.tar.bz2
donetick-862b8c925277e78bd7ecbe0d4d142ba48dc97bc9.zip
Merge branch 'dev'
to support linux_386 change the variable to be defined as int64 to Fix int overflow issue by using int64 for MaxInt64 assignments
Diffstat (limited to 'internal/chore')
-rw-r--r--internal/chore/handler.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/internal/chore/handler.go b/internal/chore/handler.go
index 333521a..16c80ef 100644
--- a/internal/chore/handler.go
+++ b/internal/chore/handler.go
@@ -1097,12 +1097,12 @@ func checkNextAssignee(chore *chModel.Chore, choresHistory []*chModel.ChoreHisto
}
}
- minChores := math.MaxInt64
+ var minChores int64 = math.MaxInt64
for assignee, numChores := range assigneeChores {
// if this is the first assignee or if the number of
// chores assigned to this assignee is less than the current minimum
- if numChores < minChores {
- minChores = numChores
+ if int64(numChores) < minChores {
+ minChores = int64(numChores)
// set the next assignee to this assignee
nextAssignee = assignee
}
@@ -1119,12 +1119,13 @@ func checkNextAssignee(chore *chModel.Chore, choresHistory []*chModel.ChoreHisto
}
// max Int value
- minChores := math.MaxInt64
+ var minChores int64 = math.MaxInt64
+
for assignee, numChores := range assigneeChores {
// if this is the first assignee or if the number of
// chores completed by this assignee is less than the current minimum
- if numChores < minChores {
- minChores = numChores
+ if int64(numChores) < minChores {
+ minChores = int64(numChores)
// set the next assignee to this assignee
nextAssignee = assignee
}