Browse Source

UI-3140: Clean up lunch hours assignment logic (#99)

4.3
Joris Tirado 7 years ago
committed by GitHub
parent
commit
91f8d0cccf
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 11 deletions
  1. +11
    -11
      submodules/strategy/strategy.js

+ 11
- 11
submodules/strategy/strategy.js View File

@ -1640,19 +1640,19 @@ define(function(require) {
if (customHours.lunchbreak.enabled) {
var lunchbreakRule = strategyData.temporalRules.lunchbreak;
// make sure the lunch rule is only valid on days the business is open
delete lunchbreakRule.wdays;
var lunchwdays = [];
_.each(customHours.opendays, function(val) {
lunchwdays.push(val.substring(4).toLowerCase());
_.assign(lunchbreakRule, {
wdays: _.map(customHours.opendays, function(item) {
// make sure the lunch rule is only valid on days the business is open
return _
.chain(item)
.lowerCase()
.replace(/^main/, '')
.value();
}),
time_window_start: monster.util.timeToSeconds(customHours.lunchbreak.from),
time_window_end: monster.util.timeToSeconds(customHours.lunchbreak.to)
});
lunchbreakRule = $.extend(true, {
wdays: lunchwdays
}, lunchbreakRule);
lunchbreakRule.time_window_start = monster.util.timeToSeconds(customHours.lunchbreak.from);
lunchbreakRule.time_window_stop = monster.util.timeToSeconds(customHours.lunchbreak.to);
tmpRulesRequests.lunchbreak = function(callback) {
self.callApi({
resource: 'temporalRule.update',


Loading…
Cancel
Save