aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorYarden Shoham <git@yardenshoham.com>2023-04-17 21:26:01 +0300
committerGitHub <noreply@github.com>2023-04-17 14:26:01 -0400
commitf045e58cc7ba076a0ac4b0b5bf0702fa155eaa59 (patch)
tree1df8a5337e1f915e3f8aae79d0c317668cd8b401 /models
parent5eb4c6386709259a9280c5aad6e0488f381144c5 (diff)
downloadgitea-f045e58cc7ba076a0ac4b0b5bf0702fa155eaa59.tar.gz
gitea-f045e58cc7ba076a0ac4b0b5bf0702fa155eaa59.zip
Localize activity heatmap (except tooltip) (#24131)
The calculation of the total sum is moved to the backend so a full HTML string could be sent. ![image](https://user-images.githubusercontent.com/20454870/232112381-c11d896b-ba47-40f8-b2a3-71cf4b3208de.png) - Closes #10669 - 2nd attempt (the first was in #21570) --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'models')
-rw-r--r--models/activities/user_heatmap.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/models/activities/user_heatmap.go b/models/activities/user_heatmap.go
index d3f0f0db73..3320799526 100644
--- a/models/activities/user_heatmap.go
+++ b/models/activities/user_heatmap.go
@@ -69,3 +69,12 @@ func getUserHeatmapData(user *user_model.User, team *organization.Team, doer *us
OrderBy("timestamp").
Find(&hdata)
}
+
+// GetTotalContributionsInHeatmap returns the total number of contributions in a heatmap
+func GetTotalContributionsInHeatmap(hdata []*UserHeatmapData) int64 {
+ var total int64
+ for _, v := range hdata {
+ total += v.Contributions
+ }
+ return total
+}