diff options
author | San Jacobs | 2022-08-07 21:08:27 +0200 |
---|---|---|
committer | San Jacobs | 2022-08-07 21:23:25 +0200 |
commit | 8ee3309484ae12ec1abb72b097499c79656da657 (patch) | |
tree | 15f3e3a28f26afd418ae028f1a01c163c7eae19f /src/time.cpp | |
parent | 05984f9d790c8218ed2cc7758e272e70c35e9c31 (diff) | |
download | satscalc-8ee3309484ae12ec1abb72b097499c79656da657.tar.gz satscalc-8ee3309484ae12ec1abb72b097499c79656da657.tar.bz2 satscalc-8ee3309484ae12ec1abb72b097499c79656da657.zip |
Added reasons to overtime rates, implemented ยง6.12
Diffstat (limited to 'src/time.cpp')
-rwxr-xr-x | src/time.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/time.cpp b/src/time.cpp index f54237f..c71521a 100755 --- a/src/time.cpp +++ b/src/time.cpp @@ -192,18 +192,18 @@ workday::workday(const moment& previous_wrap, timeblock& each_block = blocks[ii]; //std::cout << "pricing: " << timeprint(each_block) << std::endl; - if(each_block.end <= splitpoints[0]) each_block.upvalue(3); // +200% for sleep-breach - if(each_block.start.hours >= 22) each_block.upvalue(2); // Work between 22:00 + if(each_block.end <= splitpoints[0]) each_block.upvalue(3, "Sleep-breach"); // +200% for sleep-breach + if(each_block.start.hours >= 22) each_block.upvalue(2, "Night"); // Work between 22:00 if((each_block.end.hours == 6 && each_block.end.minutes == 0) ||// And 06:00 - (each_block.end.hours <= 5)) each_block.upvalue(2); // is +100% - if(each_block.start >= splitpoints[3]) {each_block.upvalue(1.5); // Overtime - if(each_block.start.getweekday() == saturday) each_block.upvalue(2);// on saturdays + (each_block.end.hours <= 5)) each_block.upvalue(2, "Night"); // is +100% + if(each_block.start >= splitpoints[3]) {each_block.upvalue(1.5, "Overtime"); // Overtime + if(each_block.start.getweekday() == saturday) each_block.upvalue(2, "Saturday overtime");// on saturdays } if(each_block.start >= planned_wraptime && // Unwarned overtime - each_block.start >= splitpoints[4]) each_block.upvalue(2); // +100% after first hour - if(each_block.start >= splitpoints[6]) each_block.upvalue(3); // +200% beyond 14-hour mark - if(each_block.start.getweekday() == saturday) each_block.upvalue(1.5);// Saturdays are +50% - if(each_block.start.getweekday() == sunday) each_block.upvalue(2); // Sundays are +100% + each_block.start >= splitpoints[4]) each_block.upvalue(2, "Overtime"); // +100% after first hour + if(each_block.start >= splitpoints[6]) each_block.upvalue(3, "Far overtime"); // +200% beyond 14-hour mark + if(each_block.start.getweekday() == saturday) each_block.upvalue(1.5, "Saturday");// Saturdays are +50% + if(each_block.start.getweekday() == sunday) each_block.upvalue(2, "Sunday"); // Sundays are +100% } } @@ -267,8 +267,11 @@ double timeblock::hourcount() { timedelta.days*24); } -float timeblock::upvalue(float suggestion){ - if(suggestion>valuefactor) valuefactor = suggestion; +float timeblock::upvalue(float suggestion, std::string reason){ + if(suggestion>valuefactor) { + valuefactor = suggestion; + price_reason = reason; + } return valuefactor; } @@ -303,6 +306,7 @@ timeblock timesplit(timeblock& input_block, const moment splitpoint) { } timeblock output{input_block.start, splitpoint}; output.valuefactor = input_block.valuefactor; + output.price_reason = input_block.price_reason; input_block.start = splitpoint; // Note: Now, reversed. return output; } |