Skip to content

Commit

Permalink
Merge branch 'dev' for release 6.3.21
Browse files Browse the repository at this point in the history
  • Loading branch information
gnepud committed Apr 29, 2024
2 parents 88e9b6f + b74ee7c commit 936d4eb
Show file tree
Hide file tree
Showing 17 changed files with 392 additions and 365 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

## Next release

## v6.3.21 2024 Avril 29

- Fix a bug: unable to show Fabmanager network project picture
- Fix a bug: availability slot date error in calendar when user pc timezone is different from server timezone
- Fix a bug: expiration_date of a subscription is not correct in the OpenAPI
- Fix a bug: unable to filter by date in the Subscription OpenAPI
- Fix a bug: unable to hide the slot of event deleted in agenda
- updates translations

## v6.3.20 2024 Avril 15

- improvement: hide gender in member create/edit form if not required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ module OpenAPI::V1::Concerns::SubscriptionsFiltersConcern
def filter_by_after(subscriptions, filters)
return subscriptions if filters[:after].blank?

subscriptions.where('created_at >= ?', Time.zone.parse(filters[:after]))
subscriptions.where('subscriptions.created_at >= ?', Time.zone.parse(filters[:after]))
end

# @param subscriptions [ActiveRecord::Relation<Subscription>]
# @param filters [ActionController::Parameters]
def filter_by_before(subscriptions, filters)
return subscriptions if filters[:before].blank?

subscriptions.where('created_at <= ?', Time.zone.parse(filters[:before]))
subscriptions.where('subscriptions.created_at <= ?', Time.zone.parse(filters[:before]))
end

# @param subscriptions [ActiveRecord::Relation<Subscription>]
Expand Down
17 changes: 17 additions & 0 deletions app/frontend/src/javascript/controllers/admin/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,9 @@ Application.Controllers.controller('CreateEventModalController', ['$scope', '$ui
// $uibModal parameter
$scope.end = end;

$scope.startTime = moment(start).format('YYYY-MM-DD HH:mm:ss');
$scope.endTime = moment(end).format('YYYY-MM-DD HH:mm:ss');

// machines list
$scope.machines = machinesPromise.filter(function (m) { return !m.disabled && m.reservable; });

Expand Down Expand Up @@ -959,13 +962,15 @@ Application.Controllers.controller('CreateEventModalController', ['$scope', '$ui
const startSlot = moment($scope.start);
startSlot.add(newValue * $scope.slots_nb, 'minutes');
$scope.end = startSlot.toDate();
$scope.endTime = moment($scope.end).format('YYYY-MM-DD HH:mm:ss');
});

// When the number of slot changes, we increment the availability to match the value
$scope.$watch('slots_nb', function (newValue, oldValue, scope) {
const startSlot = moment($scope.start);
startSlot.add($scope.availability.slot_duration * newValue, 'minutes');
$scope.end = startSlot.toDate();
$scope.endTime = moment($scope.end).format('YYYY-MM-DD HH:mm:ss');
});

// When we configure a machine/space availability, do not let the user change the end time, as the total
Expand All @@ -981,6 +986,7 @@ Application.Controllers.controller('CreateEventModalController', ['$scope', '$ui
const upperSlots = Math.ceil(slotsCurrentRange);
const upper = upperSlots * $scope.availability.slot_duration;
$scope.end = moment($scope.start).add(upper, 'minutes').toDate();
$scope.endTime = moment($scope.end).format('YYYY-MM-DD HH:mm:ss');
$scope.slots_nb = upperSlots;
} else {
$scope.slots_nb = slotsCurrentRange;
Expand Down Expand Up @@ -1014,6 +1020,17 @@ Application.Controllers.controller('CreateEventModalController', ['$scope', '$ui
$scope.availability.end_at = $scope.end;
}
});

$scope.$watch('startTime', function (newValue, oldValue, scope) {
// adjust the start/endTime
const start = moment($scope.start);
const endTime = moment($scope.endTime);
const diff = moment.tz(newValue, moment.tz.guess()).diff(moment.tz(oldValue, moment.tz.guess()));
start.add(diff, 'milliseconds');
endTime.add(diff, 'milliseconds');
$scope.start = start.toDate();
$scope.endTime = endTime.toDate();
});
};

/*
Expand Down
2 changes: 1 addition & 1 deletion app/frontend/src/javascript/filters/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ Application.Filters.filter('currency', [function ($locale) {

Application.Filters.filter('encodeURI', [function () {
return function (str) {
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
return str.replace(/[!'()*]/g, function (c) {
return '%' + c.charCodeAt(0).toString(16);
});
};
Expand Down
4 changes: 2 additions & 2 deletions app/frontend/templates/admin/calendar/eventModal.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ <h3 class="text-center red">
<p class="text-center font-sbold" translate>{{ 'app.admin.calendar.adjust_the_opening_hours' }}</p>
<div class="row">
<div class="col-md-3 col-md-offset-2">
<uib-timepicker ng-model="start" hour-step="timepickers.start.hstep" readonly-input="true" minute-step="timepickers.start.mstep" show-meridian="false"></uib-timepicker>
<uib-timepicker ng-model="startTime" hour-step="timepickers.start.hstep" readonly-input="true" minute-step="timepickers.start.mstep" show-meridian="false"></uib-timepicker>
</div>
<span class="col-md-1 m-t-xl m-l" translate>{{ 'app.admin.calendar.to_time' }}</span>
<fieldset ng-disabled="endDateReadOnly" class="col-md-5">
<uib-timepicker ng-model="end" hour-step="timepickers.end.hstep" readonly-input="true" minute-step="timepickers.end.mstep" show-meridian="false"></uib-timepicker>
<uib-timepicker ng-model="endTime" hour-step="timepickers.end.hstep" readonly-input="true" minute-step="timepickers.end.mstep" show-meridian="false"></uib-timepicker>
</fieldset>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/services/availabilities/availabilities_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def index(window, ids, events: false)
spaces_availabilities = Setting.get('spaces_module') ? spaces(Space.where(id: ids[:spaces]), @current_user, window) : []
trainings_availabilities = Setting.get('trainings_module') ? trainings(Training.where(id: ids[:trainings]), @current_user, window) : []
events_availabilities = if events && Setting.get('events_in_calendar')
events(Event.all, @current_user, window)
events(Event.where(deleted_at: nil), @current_user, window)
else
[]
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def public_availabilities(window, ids, events: false)
else
[]
end
events_slots = events ? service.events(Event.all, @current_user, window) : []
events_slots = events ? service.events(Event.where(deleted_at: nil), @current_user, window) : []

[].concat(trainings_slots).concat(events_slots).concat(machines_slots).concat(spaces_slots)
end
Expand Down
3 changes: 2 additions & 1 deletion app/views/open_api/v1/subscriptions/index.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

json.subscriptions @subscriptions do |subscription|
json.extract! subscription, :id, :created_at, :expiration_date, :canceled_at, :plan_id
json.extract! subscription, :id, :created_at, :canceled_at, :plan_id
json.user_id subscription.statistic_profile.user_id
json.expiration_date subscription.expired_at
end
Loading

0 comments on commit 936d4eb

Please sign in to comment.