mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-20 14:54:15 +01:00
(bug) unable to update availability slot end time for training
This commit is contained in:
parent
c2db98274e
commit
53b5b36b68
@ -2,6 +2,8 @@
|
||||
|
||||
## Next release
|
||||
|
||||
- Fix a bug: unable to update availability slot end time for training
|
||||
|
||||
## v6.3.22 2024 Avril 29
|
||||
|
||||
- Fix a security issue: updated rails to 7.0.8.1 to fix [CVE-2024-26143](https://github.com/rails/rails/security/advisories/GHSA-9822-6m93-xqf4)
|
||||
|
@ -1009,18 +1009,6 @@ Application.Controllers.controller('CreateEventModalController', ['$scope', '$ui
|
||||
$scope.availability.start_at = $scope.start;
|
||||
});
|
||||
|
||||
// Maintain consistency between the end time and the date object in the availability object
|
||||
$scope.$watch('end', function (newValue, oldValue, scope) {
|
||||
if (newValue.valueOf() !== oldValue.valueOf()) {
|
||||
// we prevent the admin from setting the end of the availability before its beginning
|
||||
if (moment($scope.start).add($scope.availability.slot_duration, 'minutes').isAfter(newValue)) {
|
||||
$scope.end = oldValue;
|
||||
}
|
||||
// update availability object
|
||||
$scope.availability.end_at = $scope.end;
|
||||
}
|
||||
});
|
||||
|
||||
$scope.$watch('startTime', function (newValue, oldValue, scope) {
|
||||
// adjust the start/endTime
|
||||
const start = moment($scope.start);
|
||||
@ -1031,6 +1019,15 @@ Application.Controllers.controller('CreateEventModalController', ['$scope', '$ui
|
||||
$scope.start = start.toDate();
|
||||
$scope.endTime = endTime.toDate();
|
||||
});
|
||||
|
||||
$scope.$watch('endTime', function (newValue, oldValue, scope) {
|
||||
// adjust the start/endTime
|
||||
const end = moment($scope.end);
|
||||
const diff = moment.tz(newValue, moment.tz.guess()).diff(moment.tz(oldValue, moment.tz.guess()));
|
||||
end.add(diff, 'milliseconds');
|
||||
$scope.end = end.toDate();
|
||||
$scope.availability.end_at = $scope.end;
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user