summaryrefslogtreecommitdiffstats
path: root/web_src
diff options
context:
space:
mode:
authorsiddweiker <siddweiker@users.noreply.github.com>2021-06-25 18:59:25 +0200
committerGitHub <noreply@github.com>2021-06-25 18:59:25 +0200
commitf573e93ed429d1d1dd0a7be8a3b0042f0817cc00 (patch)
treed71db3d42e18da8dd0910ac1e2db04ab841e0e9b /web_src
parentUse gitea logging module for git module (#16243) (diff)
downloadforgejo-f573e93ed429d1d1dd0a7be8a3b0042f0817cc00.tar.xz
forgejo-f573e93ed429d1d1dd0a7be8a3b0042f0817cc00.zip
Fix heatmap activity (#15252)
* Group heatmap actions by 15 minute intervals Signed-off-by: Sidd Weiker <siddweiker@gmail.com> * Add multi-contribution test for user heatmap Signed-off-by: Sidd Weiker <siddweiker@gmail.com> * Add timezone aware summation for activity heatmap Signed-off-by: Sidd Weiker <siddweiker@gmail.com> * Fix api user heatmap test Signed-off-by: Sidd Weiker <siddweiker@gmail.com> * Update variable declaration style Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'web_src')
-rw-r--r--web_src/js/features/heatmap.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/web_src/js/features/heatmap.js b/web_src/js/features/heatmap.js
index d1cb43dde0..07ecaee461 100644
--- a/web_src/js/features/heatmap.js
+++ b/web_src/js/features/heatmap.js
@@ -7,8 +7,15 @@ export default async function initHeatmap() {
if (!el) return;
try {
- const values = JSON.parse(el.dataset.heatmapData).map(({contributions, timestamp}) => {
- return {date: new Date(timestamp * 1000), count: contributions};
+ const heatmap = {};
+ JSON.parse(el.dataset.heatmapData).forEach(({contributions, timestamp}) => {
+ // Convert to user timezone and sum contributions by date
+ const dateStr = new Date(timestamp * 1000).toDateString();
+ heatmap[dateStr] = (heatmap[dateStr] || 0) + contributions;
+ });
+
+ const values = Object.keys(heatmap).map((v) => {
+ return {date: new Date(v), count: heatmap[v]};
});
const View = Vue.extend({