Skip to content
Snippets Groups Projects
Commit 7f24961f authored by Clement Ho's avatar Clement Ho
Browse files

Reduce contributions calendar data payload

parent 9b079219
No related branches found
No related tags found
No related merge requests found
Please view this file on the master branch, on stable branches it's out of date. Please view this file on the master branch, on stable branches it's out of date.
v 8.12.0 (unreleased) v 8.12.0 (unreleased)
- Optimistic locking for Issues and Merge Requests (title and description overriding prevention) - Optimistic locking for Issues and Merge Requests (title and description overriding prevention)
- Reduce contributions calendar data payload (ClemMakesApps)
   
v 8.11.0 v 8.11.0
- Use test coverage value from the latest successful pipeline in badge. !5862 - Use test coverage value from the latest successful pipeline in badge. !5862
Loading
Loading
Loading
@@ -67,6 +67,14 @@
Loading
@@ -67,6 +67,14 @@
$.timeago.settings.strings = tmpLocale; $.timeago.settings.strings = tmpLocale;
}; };
   
w.gl.utils.getDayDifference = function(a, b) {
var minutesPerDay = 1000 * 60 * 60 * 24;
var date1 = Date.UTC(a.getFullYear(), a.getMonth(), a.getDate());
var date2 = Date.UTC(b.getFullYear(), b.getMonth(), b.getDate());
return Math.floor((date2 - date1) / minutesPerDay);
}
})(window); })(window);
   
}).call(this); }).call(this);
Loading
@@ -3,7 +3,6 @@
Loading
@@ -3,7 +3,6 @@
   
this.Calendar = (function() { this.Calendar = (function() {
function Calendar(timestamps, calendar_activities_path) { function Calendar(timestamps, calendar_activities_path) {
var group, i;
this.calendar_activities_path = calendar_activities_path; this.calendar_activities_path = calendar_activities_path;
this.clickDay = bind(this.clickDay, this); this.clickDay = bind(this.clickDay, this);
this.currentSelectedDate = ''; this.currentSelectedDate = '';
Loading
@@ -13,26 +12,36 @@
Loading
@@ -13,26 +12,36 @@
this.monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; this.monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
this.months = []; this.months = [];
this.timestampsTmp = []; this.timestampsTmp = [];
i = 0; var group = 0;
group = 0;
_.each(timestamps, (function(_this) { var today = new Date()
return function(count, date) { today.setHours(0, 0, 0, 0, 0);
var day, innerArray, newDate;
newDate = new Date(parseInt(date) * 1000); var oneYearAgo = new Date(today);
day = newDate.getDay(); oneYearAgo.setFullYear(today.getFullYear() - 1);
if ((day === 0 && i !== 0) || i === 0) {
_this.timestampsTmp.push([]); var days = gl.utils.getDayDifference(oneYearAgo, today);
group++;
} for(var i = 0; i <= days; i++) {
innerArray = _this.timestampsTmp[group - 1]; var date = new Date(oneYearAgo);
innerArray.push({ date.setDate(date.getDate() + i);
count: count,
date: newDate, var day = date.getDay();
day: day var count = timestamps[date.getTime() * 0.001];
});
return i++; if ((day === 0 && i !== 0) || i === 0) {
}; this.timestampsTmp.push([]);
})(this)); group++;
}
var innerArray = this.timestampsTmp[group - 1];
innerArray.push({
count: count || 0,
date: date,
day: day
});
}
this.colorKey = this.initColorKey(); this.colorKey = this.initColorKey();
this.color = this.initColor(); this.color = this.initColor();
this.renderSvg(group); this.renderSvg(group);
Loading
Loading
Loading
@@ -23,7 +23,6 @@ module Gitlab
Loading
@@ -23,7 +23,6 @@ module Gitlab
   
dates.each do |date| dates.each do |date|
date_id = date.to_time.to_i.to_s date_id = date.to_time.to_i.to_s
@timestamps[date_id] = 0
day_events = events.find { |day_events| day_events["date"] == date } day_events = events.find { |day_events| day_events["date"] == date }
   
if day_events if day_events
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment