Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
69b098f
Initial weektoweek
Nov 29, 2018
021a921
More updates for weektoweek
Dec 1, 2018
af8a1c6
Add weektoweek report to index
Dec 1, 2018
4877a9c
Fix syntax error
Dec 1, 2018
5c65790
Fix syntax error
Dec 1, 2018
f70f0ed
Fix spelling for localeData
Dec 1, 2018
8e573b7
Fix initialization of weekstoshow array
Dec 1, 2018
e41f8f8
Initialize new week
Dec 1, 2018
f6bfec0
Fix call to prepareHtml
Dec 1, 2018
9713783
Make new sgv array for each week
Dec 2, 2018
d157313
Fix reference into datastorage array
Dec 2, 2018
88cd9aa
Increment currDay as required
Dec 2, 2018
670f172
Add weektoweek debug logs
Dec 2, 2018
f74eeaf
Fix syntax error
Dec 2, 2018
577726b
Fixed index error
Dec 2, 2018
72bc14c
Handle sort order differences
Dec 2, 2018
6605535
Sort week before prepareHtml
Dec 2, 2018
75c05f9
Fix syntax error
Dec 2, 2018
b38bea3
Test fix for week partition
Dec 3, 2018
c12ec3b
Fix first day of week getting squashed
Dec 3, 2018
b6fd5f7
Fix it for real this time
Dec 3, 2018
3c20084
Don't move to next week if current week is empty
Dec 4, 2018
34990da
Fix syntax error
Dec 4, 2018
14fa9ef
Color by day and week report specific size and scale
Dec 5, 2018
3af52f9
Comment out some debug
Dec 5, 2018
49bcfcf
style format update
Dec 5, 2018
6825eda
Use from and to dates to set week span for week2week
Dec 5, 2018
594bae9
Fix newest on top start point
Dec 5, 2018
9ecdb89
Fix newest on top
Dec 5, 2018
06d7e4e
Don't render week to week if not selected
Dec 5, 2018
d31099d
Add unit test for weektoweek report
Dec 6, 2018
cd6fb2e
Remove weektoweek logging code
Dec 6, 2018
aa90fd5
Fix week 2 week report when not all weekdays are selected
Dec 8, 2018
6aef8ed
Fix weekNum calculation
Dec 8, 2018
bef3b69
Make week2week more resilient to date selections
Dec 8, 2018
30feb86
Fix codacy findings
Dec 8, 2018
ed97169
Remove more unused variables
Dec 8, 2018
8f29632
Make weektoweek use SCALE_Y system setting correctly
Jan 5, 2019
716fd76
Make default scale y initialize correctly
Jan 5, 2019
a2a9248
Cleanup code for initializing weektoweek scale
Jan 5, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix week 2 week report when not all weekdays are selected
  • Loading branch information
Jeremy Cunningham committed Dec 8, 2018
commit aa90fd5af03de4c8cc3b93fe8aa3a05c859f8655
18 changes: 7 additions & 11 deletions lib/report_plugins/weektoweek.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,23 +91,19 @@ weektoweek.report = function report_weektoweek(datastorage, sorteddaystoshow, op
var carbsSum = 0;

var weekstoshow = [ ];
weekstoshow[0] = [ ];
var weekIdx = 0;
var dayIdx = 0;
var reset_day = 0;

reset_day = moment(sorteddaystoshow[0]).day();
var startDay = moment(sorteddaystoshow[0]);

sorteddaystoshow.forEach( function eachDay(day) {
if ((dayIdx > 0) && (moment(day).day() === reset_day)) {
weekIdx += 1;
weekstoshow[weekIdx] = [ ];
weekstoshow[weekIdx][0] = day;
dayIdx = 1;
} else {
weekstoshow[weekIdx][dayIdx] = day;
dayIdx += 1;
var weekNum = Math.floor(Math.abs(moment(day).subtract(startDay, 'weeks')));

if (!weekstoshow.includes(weekNum)) {
weekstoshow[weekNum] = [ ];
}

weekstoshow[weekNum].push(day);
});

weekstoshow = weekstoshow.map(function orderWeek(week) {
Expand Down