Skip to content

Commit

Permalink
Merge pull request #659 from OpenOlitor/fix/OO_duplicate_working_oppo…
Browse files Browse the repository at this point in the history
…rtunity_wrong_time

Fix/oo duplicate working opportunity wrong time
  • Loading branch information
mcmpp committed Jul 19, 2023
2 parents f441884 + b17ac14 commit f161760
Showing 1 changed file with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ angular.module('openolitor-admin')
'$log', 'arbeitsangebot', 'moment', 'RHYTHMEN', 'EnumUtil','lodash',
function($scope, $uibModalInstance, $log, arbeitsangebot, moment, RHYTHMEN, EnumUtil, lodash) {
$scope.initVon = arbeitsangebot.zeitVon;
$scope.initBis = arbeitsangebot.zeitBis;
$scope.von = arbeitsangebot.zeitVon;
$scope.arbeitsangebot = arbeitsangebot;
$scope.daten = [];
Expand Down Expand Up @@ -48,15 +49,17 @@ angular.module('openolitor-admin')

var selectedWeekday = start.isoWeekday();
var startingWeekday = moment($scope.initVon).isoWeekday();
if (selectedWeekday <= startingWeekday) {
//selektiere wochentag in derselben Woche
start = start.isoWeekday(startingWeekday);
} else {
//selektiere Wochentag in der darauffolgenden Woche
start = start.isoWeekday(startingWeekday + 7);
if ($scope.rhythmus !== RHYTHMEN.TAEGLICH) {
if (selectedWeekday <= startingWeekday) {
//select weekday in the same week
start = start.isoWeekday(startingWeekday);
} else {
//select weekday in the following week
start = start.isoWeekday(startingWeekday + 7);
}
}

//iteriere abhängig vom lierferrythmus
//iterate depending on the distribution pace
var step;
var stepEinheit;
if ($scope.rhythmus === RHYTHMEN.TAEGLICH) {
Expand All @@ -72,7 +75,7 @@ angular.module('openolitor-admin')
step = 1;
stepEinheit = 'M';
} else {
//date können nicht berechnet werden
//date cannot be calculated
return;
}

Expand All @@ -93,12 +96,14 @@ angular.module('openolitor-admin')

$scope.$watch('von', function(value) {
if (value) {
value.setHours($scope.initVon.getHours(),$scope.initVon.getMinutes(),$scope.initVon.getSeconds());
generateDaten();
}
});

$scope.$watch('bis', function(value) {
if (value) {
value.setHours($scope.initBis.getHours(),$scope.initBis.getMinutes(),$scope.initBis.getSeconds());
generateDaten();
}
});
Expand All @@ -114,7 +119,7 @@ angular.module('openolitor-admin')
});

if (!alreadyPlanned){
addDaten(value);
addDaten(value.setHours($scope.initVon.getHours(),$scope.initVon.getMinutes(),$scope.initVon.getSeconds()));
}
}
});
Expand Down

0 comments on commit f161760

Please sign in to comment.