Reduce payload for contributions calendar data
Summary
Most users tend not to have contribution data for every day of their past year. Rather than having the payload for the contribution data return the entire set of calendar data, we can return just the dates where the user has had contribution activity. This would reduce the user's bandwidth and the increase the speed to load that page.
Steps to reproduce
- Open up developer tools (networking tab)
- Go to your profile page or you can go to mine
- Inspect the web request for
/calendar
Expected behavior
new Calendar(
{"1455840000": 2, "1456963200": 1, "1458000000": 2, "1458086400": 1, "1458777600": 2, "1459468800": 1, "1459555200": 2 .... },
'/u/ClemMakesApps/calendar_activities'
);
Relevant logs and/or screenshots
When the browser is empty cache and hard reload
, the calendar payload is always 6.1kb and a lot of the content can end up being a lot of zeros (below is a shortened version to keep this issue pretty
new Calendar(
{"1439251200": 0, "1439337600": 0, "1439424000": 0, "1439510400": 0, "1439596800": 0, "1439683200": 2, "1439769600": 1 ..... },
'/u/ClemMakesApps/calendar_activities'
);
Possible fixes
Use javascript to process the dates with contribution activity and generate the graph (If you can, link to the line of code that might be responsible for the problem)