From 6a8c441e857106221386d9ddc0ea01e53254dc95 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 18 Jul 2022 17:17:21 +0200 Subject: [PATCH] public calendar endpoint refactoring & testing --- CHANGELOG.md | 3 + .../api/availabilities_controller.rb | 47 +- app/controllers/api/events_controller.rb | 2 + .../src/javascript/controllers/calendar.js | 5 +- app/models/availability.rb | 2 +- .../availabilities/availabilities_service.rb | 51 +- .../create_availabilities_service.rb | 63 +- .../public_availabilities_service.rb | 102 +-- app/services/availabilities/status_service.rb | 28 +- app/services/event_service.rb | 16 +- .../api/availabilities/public.json.jbuilder | 66 +- test/fixtures/availabilities.yml | 68 +- test/fixtures/invoices.yml | 5 + test/fixtures/invoicing_profiles.yml | 7 + test/fixtures/payment_gateway_objects.yml | 22 + test/fixtures/payment_schedule_items.yml | 169 +++++ test/fixtures/payment_schedule_objects.yml | 12 +- test/fixtures/payment_schedules.yml | 16 + test/fixtures/profiles.yml | 11 + test/fixtures/slots.yml | 688 ++++-------------- test/fixtures/statistic_profiles.yml | 7 + test/fixtures/subscriptions.yml | 9 + test/fixtures/trainings_availabilities.yml | 7 + test/fixtures/users.yml | 32 + test/fixtures/wallets.yml | 4 + .../availabilities/as_public_test.rb | 6 +- .../availabilities/as_user_test.rb | 2 + .../reservations/create_as_admin_test.rb | 2 +- test/services/availabilities_service_test.rb | 94 +++ ...iption_extension_after_reservation_test.rb | 9 +- 30 files changed, 741 insertions(+), 814 deletions(-) create mode 100644 test/services/availabilities_service_test.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 600169ff8..67ca71b8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## next deploy +- Improved calendars loading time +- Refactored and documented the availability-slot-reservation data model +- Fix a bug: unable to book a space's slot with an existing reservation - Fix a bug: Unable to import accounts from SSO when the transformation modal was opened but leaved empty ## v5.4.12 2022 July 06 diff --git a/app/controllers/api/availabilities_controller.rb b/app/controllers/api/availabilities_controller.rb index 6cfdf7392..c5d2992c0 100644 --- a/app/controllers/api/availabilities_controller.rb +++ b/app/controllers/api/availabilities_controller.rb @@ -20,19 +20,14 @@ class API::AvailabilitiesController < API::ApiController end def public - # FIXME, use AvailabilitiesService display_window = window - @reservations = Reservation.includes(:slots, :statistic_profile) - .references(:slots) - .where('slots.start_at >= ? AND slots.end_at <= ?', display_window[:start], display_window[:end]) machine_ids = params[:m] || [] service = Availabilities::PublicAvailabilitiesService.new(current_user) @availabilities = service.public_availabilities( - display_window[:start], - display_window[:end], - @reservations, - machines: machine_ids, spaces: params[:s] + display_window, + { machines: machine_ids, spaces: params[:s], trainings: params[:t] }, + (params[:evt] && params[:evt] == 'true') ) @title_filter = { machine_ids: machine_ids.map(&:to_i) } @@ -47,10 +42,8 @@ class API::AvailabilitiesController < API::ApiController authorize Availability @availability = Availability.new(availability_params) if @availability.save - if params[:availability][:occurrences] - service = Availabilities::CreateAvailabilitiesService.new - service.create(@availability, params[:availability][:occurrences]) - end + service = Availabilities::CreateAvailabilitiesService.new + service.create(@availability, params[:availability][:occurrences]) render :show, status: :created, location: @availability else render json: @availability.errors, status: :unprocessable_entity @@ -170,35 +163,7 @@ class API::AvailabilitiesController < API::ApiController end def filter_availabilites(availabilities) - availabilities_filtered = [] - availabilities.to_ary.each do |a| - # machine slot - if !a.try(:available_type) - availabilities_filtered << a - else - availabilities_filtered << a if filter_training?(a) - availabilities_filtered << a if filter_space?(a) - availabilities_filtered << a if filter_machine?(a) - availabilities_filtered << a if filter_event?(a) - end - end - availabilities_filtered.delete_if(&method(:remove_full?)) - end - - def filter_training?(availability) - params[:t] && availability.available_type == 'training' && params[:t].include?(availability.trainings.first.id.to_s) - end - - def filter_space?(availability) - params[:s] && availability.available_type == 'space' && params[:s].include?(availability.spaces.first.id.to_s) - end - - def filter_machine?(availability) - params[:m] && availability.available_type == 'machines' && (params[:m].map(&:to_i) & availability.machine_ids).any? - end - - def filter_event?(availability) - params[:evt] && params[:evt] == 'true' && availability.available_type == 'event' + availabilities.delete_if(&method(:remove_full?)) end def remove_full?(availability) diff --git a/app/controllers/api/events_controller.rb b/app/controllers/api/events_controller.rb index 0c051743a..26f7300e0 100644 --- a/app/controllers/api/events_controller.rb +++ b/app/controllers/api/events_controller.rb @@ -55,6 +55,8 @@ class API::EventsController < API::ApiController authorize Event @event = Event.new(event_params.permit!) if @event.save + service = Availabilities::CreateAvailabilitiesService.new + service.create_slots(@event.availability) render :show, status: :created, location: @event else render json: @event.errors, status: :unprocessable_entity diff --git a/app/frontend/src/javascript/controllers/calendar.js b/app/frontend/src/javascript/controllers/calendar.js index 9133c5bfb..d04b0dd06 100644 --- a/app/frontend/src/javascript/controllers/calendar.js +++ b/app/frontend/src/javascript/controllers/calendar.js @@ -216,8 +216,9 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$ } else if (event.available_type === 'training') { $state.go('app.public.training_show', { id: event.training_id }); } else { - if (event.machine_id) { - $state.go('app.public.machines_show', { id: event.machine_id }); + if (event.machine_ids) { + // TODO open modal to ask the user to select the machine to show + $state.go('app.public.machines_show', { id: event.machine_ids[0] }); } else if (event.space_id) { $state.go('app.public.space_show', { id: event.space_id }); } diff --git a/app/models/availability.rb b/app/models/availability.rb index d45e6cc91..a794c9a50 100644 --- a/app/models/availability.rb +++ b/app/models/availability.rb @@ -37,7 +37,7 @@ class Availability < ApplicationRecord scope :trainings, -> { includes(:trainings).where(available_type: 'training') } scope :spaces, -> { includes(:spaces).where(available_type: 'space') } - attr_accessor :is_reserved, :slot_id, :can_modify + attr_accessor :is_reserved, :current_user_slots_reservations_ids, :can_modify validates :start_at, :end_at, presence: true validate :length_must_be_slot_multiple, unless: proc { end_at.blank? or start_at.blank? } diff --git a/app/services/availabilities/availabilities_service.rb b/app/services/availabilities/availabilities_service.rb index 303a06e74..31242cdfb 100644 --- a/app/services/availabilities/availabilities_service.rb +++ b/app/services/availabilities/availabilities_service.rb @@ -1,29 +1,38 @@ # frozen_string_literal: true -# Provides helper methods for Availability resources and properties +# List all Availability's slots for the given resources class Availabilities::AvailabilitiesService - def initialize(current_user) + def initialize(current_user, level = 'slot') @current_user = current_user @maximum_visibility = { year: Setting.get('visibility_yearly').to_i.months.since, other: Setting.get('visibility_others').to_i.months.since } @service = Availabilities::StatusService.new(current_user&.role) + @level = level end # list all slots for the given machine, with visibility relative to the given user def machines(machine, user, window) availabilities = availabilities(machine.availabilities, 'machines', user, window[:start], window[:end]) - availabilities.map(&:slots).flatten.map { |s| @service.slot_reserved_status(s, user, [machine]) } + if @level == 'slot' + availabilities.map(&:slots).flatten.map { |s| @service.slot_reserved_status(s, user, [machine]) } + else + availabilities.map { |a| @service.availability_reserved_status(a, user, [machine]) } + end end # list all slots for the given space, with visibility relative to the given user def spaces(space, user, window) availabilities = availabilities(space.availabilities, 'space', user, window[:start], window[:end]) - availabilities.map(&:slots).flatten.map { |s| @service.slot_reserved_status(s, user, [space]) } + if @level == 'slot' + availabilities.map(&:slots).flatten.map { |s| @service.slot_reserved_status(s, user, [space]) } + else + availabilities.map { |a| @service.availability_reserved_status(a, user, [space]) } + end end # list all slots for the given training(s), with visibility relative to the given user @@ -32,7 +41,23 @@ class Availabilities::AvailabilitiesService .where('trainings_availabilities.training_id': trainings.map(&:id)) availabilities = availabilities(tr_availabilities, 'training', user, window[:start], window[:end]) - availabilities.map(&:slots).flatten.map { |s| @service.slot_reserved_status(s, user, s.availability.trainings) } + if @level == 'slot' + availabilities.map(&:slots).flatten.map { |s| @service.slot_reserved_status(s, user, s.availability.trainings) } + else + availabilities.map { |a| @service.availability_reserved_status(a, user, a.trainings) } + end + end + + # list all slots for the given event(s), with visibility relative to the given user + def events(events, user, window) + ev_availabilities = Availability.includes('event').where('events.id': events.map(&:id)) + availabilities = availabilities(ev_availabilities, 'event', user, window[:start], window[:end]) + + if @level == 'slot' + availabilities.map(&:slots).flatten.map { |s| @service.slot_reserved_status(s, user, [s.availability.event]) } + else + availabilities.map { |a| @service.availability_reserved_status(a, user, [a.event]) } + end end private @@ -45,7 +70,7 @@ class Availabilities::AvailabilitiesService # the trainings further in the futur. This is used to prevent users with a rolling subscription to take # their first training in a very long delay. def show_more_trainings?(user) - user.trainings.size.positive? && subscription_year?(user) + user&.trainings&.size&.positive? && subscription_year?(user) end def availabilities(availabilities, type, user, range_start, range_end) @@ -53,8 +78,10 @@ class Availabilities::AvailabilitiesService # 1) an admin (he can see all availabilities from 1 month ago to anytime in the future) if @current_user&.admin? || @current_user&.manager? window_start = [range_start, 1.month.ago].max - availabilities.includes(:tags, :plans) - .where('start_at <= ? AND end_at >= ? AND available_type = ?', range_end, window_start, type) + availabilities.includes(:tags, :plans, :slots) + .joins(:slots) + .where('availabilities.start_at <= ? AND availabilities.end_at >= ? AND available_type = ?', range_end, window_start, type) + .where('slots.start_at > ? AND slots.end_at < ?', window_start, range_end) .where(lock: false) # 2) an user (he cannot see past availabilities neither those further than 1 (or 3) months in the future) else @@ -63,9 +90,11 @@ class Availabilities::AvailabilitiesService end_at = @maximum_visibility[:year] if show_more_trainings?(user) && type == 'training' window_end = [end_at, range_end].min window_start = [range_start, DateTime.current].max - availabilities.includes(:tags, :plans) - .where('start_at < ? AND end_at > ? AND available_type = ?', window_end, window_start, type) - .where('availability_tags.tag_id' => user.tag_ids.concat([nil])) + availabilities.includes(:tags, :plans, :slots) + .joins(:slots) + .where('availabilities.start_at <= ? AND availabilities.end_at >= ? AND available_type = ?', window_end, window_start, type) + .where('slots.start_at > ? AND slots.end_at < ?', window_start, window_end) + .where('availability_tags.tag_id' => user&.tag_ids&.concat([nil])) .where(lock: false) end end diff --git a/app/services/availabilities/create_availabilities_service.rb b/app/services/availabilities/create_availabilities_service.rb index 5535d05e0..45961c7a0 100644 --- a/app/services/availabilities/create_availabilities_service.rb +++ b/app/services/availabilities/create_availabilities_service.rb @@ -1,44 +1,47 @@ # frozen_string_literal: true -# Provides helper methods to create an Availability with multiple occurrences +# Provides an helper method to create the slots for an Availability and optionnaly, for its multiple occurrences class Availabilities::CreateAvailabilitiesService def create(availability, occurrences = []) availability.update_attributes(occurrence_id: availability.id) - slot_duration = availability.slot_duration || Setting.get('slot_duration').to_i + create_slots(availability) occurrences.each do |o| start_at = Time.zone.parse(o[:start_at]) end_at = Time.zone.parse(o[:end_at]) - avail = if availability.start_at == start_at && availability.end_at == end_at - availability - else - Availability.create!( - start_at: start_at, - end_at: end_at, - available_type: availability.available_type, - is_recurrent: availability.is_recurrent, - period: availability.period, - nb_periods: availability.nb_periods, - end_date: availability.end_date, - occurrence_id: availability.occurrence_id, - machine_ids: availability.machine_ids, - training_ids: availability.training_ids, - space_ids: availability.space_ids, - tag_ids: availability.tag_ids, - nb_total_places: availability.nb_total_places, - slot_duration: availability.slot_duration, - plan_ids: availability.plan_ids - ) - end + next if availability.start_at == start_at && availability.end_at == end_at - ((end_at - start_at) / slot_duration.minutes).to_i.times do |i| - Slot.new( - start_at: start_at + (i * slot_duration).minutes, - end_at: start_at + (i * slot_duration).minutes + slot_duration.minutes, - availability_id: avail.id - ).save! - end + occ = Availability.create!( + start_at: start_at, + end_at: end_at, + available_type: availability.available_type, + is_recurrent: availability.is_recurrent, + period: availability.period, + nb_periods: availability.nb_periods, + end_date: availability.end_date, + occurrence_id: availability.occurrence_id, + machine_ids: availability.machine_ids, + training_ids: availability.training_ids, + space_ids: availability.space_ids, + tag_ids: availability.tag_ids, + nb_total_places: availability.nb_total_places, + slot_duration: availability.slot_duration, + plan_ids: availability.plan_ids + ) + create_slots(occ) + end + end + + def create_slots(availability) + slot_duration = availability.slot_duration || Setting.get('slot_duration').to_i + + ((availability.end_at - availability.start_at) / slot_duration.minutes).to_i.times do |i| + Slot.new( + start_at: availability.start_at + (i * slot_duration).minutes, + end_at: availability.start_at + (i * slot_duration).minutes + slot_duration.minutes, + availability_id: availability.id + ).save! end end end diff --git a/app/services/availabilities/public_availabilities_service.rb b/app/services/availabilities/public_availabilities_service.rb index ca3b77861..88a9103d4 100644 --- a/app/services/availabilities/public_availabilities_service.rb +++ b/app/services/availabilities/public_availabilities_service.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true # Provides helper methods for public calendar of Availability -# FIXME, Availabilities::StatusService was refactored -# TODO, Use Availabilities::AvailabilitiesService class Availabilities::PublicAvailabilitiesService def initialize(current_user) @current_user = current_user @@ -10,95 +8,39 @@ class Availabilities::PublicAvailabilitiesService end # provides a list of slots and availabilities for the machines, between the given dates - def machines(start_date, end_date, reservations, machine_ids) - availabilities = Availability.includes(:tags, :machines) - .where(available_type: 'machines') - .where('start_at >= ? AND end_at <= ?', start_date, end_date) - .where(lock: false) + def machines(window, machine_ids, level) + machine_ids = [] if machine_ids.nil? + service = Availabilities::AvailabilitiesService.new(@current_user, level) slots = [] - availabilities.each do |a| - slot_duration = a.slot_duration || Setting.get('slot_duration').to_i - a.machines.each do |machine| - next unless machine_ids&.include?(machine.id.to_s) - - ((a.end_at - a.start_at) / slot_duration.minutes).to_i.times do |i| - slot = Slot.new( - start_at: a.start_at + (i * slot_duration).minutes, - end_at: a.start_at + (i * slot_duration).minutes + slot_duration.minutes, - availability_id: a.id, - availability: a, - machine: machine, - title: machine.name - ) - slot = @service.machine_reserved_status(slot, reservations, @current_user) - slots << slot - end - end + machine_ids.each do |machine_id| + machine = Machine.friendly.find(machine_id) + slots.concat(service.machines(machine, @current_user, window)) end - { availabilities: availabilities, slots: slots } + slots end # provides a list of slots and availabilities for the spaces, between the given dates - def spaces(start_date, end_date, reservations, available_id) - availabilities = Availability.includes(:tags, :spaces).where(available_type: 'space') - .where('start_at >= ? AND end_at <= ?', start_date, end_date) - .where(lock: false) - - availabilities.where(available_id: available_id) if available_id - + def spaces(window, spaces_ids, level) + spaces_ids = [] if spaces_ids.nil? + service = Availabilities::AvailabilitiesService.new(@current_user, level) slots = [] - availabilities.each do |a| - slot_duration = a.slot_duration || Setting.get('slot_duration').to_i - space = a.spaces.first - ((a.end_at - a.start_at) / slot_duration.minutes).to_i.times do |i| - next unless (a.start_at + (i * slot_duration).minutes) > DateTime.current - - slot = Slot.new( - start_at: a.start_at + (i * slot_duration).minutes, - end_at: a.start_at + (i * slot_duration).minutes + slot_duration.minutes, - availability_id: a.id, - availability: a, - space: space, - title: space.name - ) - slot = @service.space_reserved_status(slot, reservations, @current_user) - slots << slot - end + spaces_ids.each do |space_id| + space = Space.friendly.find(space_id) + slots.concat(service.spaces(space, @current_user, window)) end - { availabilities: availabilities, slots: slots } + slots end - def public_availabilities(start_date, end_date, reservations, ids) - if in_same_day(start_date, end_date) - # request for 1 single day + def public_availabilities(window, ids, events = false) + level = in_same_day(window[:start], window[:end]) ? 'slot' : 'availability' + service = Availabilities::AvailabilitiesService.new(@current_user, level) - # trainings, events - training_event_availabilities = Availability.includes(:tags, :trainings, :slots) - .where(available_type: %w[training event]) - .where('start_at >= ? AND end_at <= ?', start_date, end_date) - .where(lock: false) - # machines - machines_avail = machines(start_date, end_date, reservations, ids[:machines]) - machine_slots = machines_avail[:slots] - # spaces - spaces_avail = spaces(start_date, end_date, reservations, ids[:spaces]) - space_slots = spaces_avail[:slots] + machines_slots = machines(window, ids[:machines], level) + spaces_slots = spaces(window, ids[:spaces], level) + trainings_slots = service.trainings(Training.where(id: ids[:trainings]), @current_user, window) + events_slots = events ? service.events(Event.all, @current_user, window) : [] - [].concat(training_event_availabilities).concat(machine_slots).concat(space_slots) - else - # request for many days (week or month) - avails = Availability.includes(:tags, :machines, :trainings, :spaces, :event, :slots) - .where('start_at >= ? AND end_at <= ?', start_date, end_date) - .where(lock: false) - avails.each do |a| - if a.available_type == 'training' || a.available_type == 'event' - a = @service.training_event_reserved_status(a, reservations, @current_user) - elsif a.available_type == 'space' - a.is_reserved = @service.reserved_availability?(a, @current_user) - end - end - avails - end + [].concat(trainings_slots).concat(events_slots).concat(machines_slots).concat(spaces_slots) end private diff --git a/app/services/availabilities/status_service.rb b/app/services/availabilities/status_service.rb index 71376245d..7b66b454f 100644 --- a/app/services/availabilities/status_service.rb +++ b/app/services/availabilities/status_service.rb @@ -10,6 +10,10 @@ class Availabilities::StatusService # check that the provided slot is reserved for the given reservable (machine, training or space). # Mark it accordingly for display in the calendar def slot_reserved_status(slot, user, reservables) + unless reservables.map(&:class).map(&:name).reduce(:==) + raise TypeError('[Availabilities::StatusService#slot_reserved_status] reservables have differents types') + end + statistic_profile_id = user&.statistic_profile&.id slots_reservations = slot.slots_reservations @@ -29,16 +33,22 @@ class Availabilities::StatusService end # check that the provided ability is reserved by the given user - def reserved_availability?(availability, user) - if user - reserved_slots = [] - availability.slots.each do |s| - reserved_slots << s if s.canceled_at.nil? - end - reserved_slots.map(&:reservations).flatten.map(&:statistic_profile_id).include? user.statistic_profile&.id - else - false + def availability_reserved_status(availability, user, reservables) + unless reservables.map(&:class).map(&:name).reduce(:==) + raise TypeError('[Availabilities::StatusService#availability_reserved_status] reservables have differents types') end + + slots_reservations = availability.slots_reservations + .includes(:reservation) + .where('reservations.reservable_type': reservables.map(&:class).map(&:name)) + .where('reservations.reservable_id': reservables.map(&:id)) + .where('slots_reservations.canceled_at': nil) + + user_slots_reservations = slots_reservations.where('reservations.statistic_profile_id': user&.statistic_profile&.id) + + availability.is_reserved = !slots_reservations.empty? + availability.current_user_slots_reservations_ids = user_slots_reservations.map(&:id) + availability end private diff --git a/app/services/event_service.rb b/app/services/event_service.rb index 860391532..c27c6b47d 100644 --- a/app/services/event_service.rb +++ b/app/services/event_service.rb @@ -166,27 +166,33 @@ class EventService e_params = e_params.merge( event_files_attributes: ef_attributes ) + original_slots_ids = event.availability.slots.map(&:id) begin results[:events].push status: !!e.update(e_params.permit!), event: e # rubocop:disable Style/DoubleNegation rescue StandardError => err results[:events].push status: false, event: e, error: err.try(:record).try(:class).try(:name), message: err.message end - results[:slots].concat(update_slots(e.availability_id)) + results[:slots].concat(update_slots(e.availability_id, original_slots_ids)) end + original_slots_ids = event.availability.slots.map(&:id) begin + event_params[:availability_attributes][:id] = event.availability_id results[:events].push status: !!event.update(event_params), event: event # rubocop:disable Style/DoubleNegation rescue StandardError => err results[:events].push status: false, event: event, error: err.try(:record).try(:class).try(:name), message: err.message end - results[:slots].concat(update_slots(event.availability_id)) + results[:slots].concat(update_slots(event.availability_id, original_slots_ids)) results end - def update_slots(availability_id) + def update_slots(availability_id, original_slots_ids) results = [] avail = Availability.find(availability_id) - avail.slots.each do |s| - results.push(status: !!s.update_attributes(start_at: avail.start_at, end_at: avail.end_at), slot: s) # rubocop:disable Style/DoubleNegation + Slot.where(id: original_slots_ids).each do |slot| + results.push( + status: !!slot.update_attributes(availability_id: availability_id, start_at: avail.start_at, end_at: avail.end_at), # rubocop:disable Style/DoubleNegation + slot: slot + ) rescue StandardError => err results.push status: false, slot: s, error: err.try(:record).try(:class).try(:name), message: err.message end diff --git a/app/views/api/availabilities/public.json.jbuilder b/app/views/api/availabilities/public.json.jbuilder index d656b22fe..23c65b64f 100644 --- a/app/views/api/availabilities/public.json.jbuilder +++ b/app/views/api/availabilities/public.json.jbuilder @@ -1,18 +1,18 @@ +# frozen_string_literal: true + json.array!(@availabilities) do |availability| json.id availability.id json.start availability.start_at.iso8601 json.end availability.end_at.iso8601 json.textColor 'black' json.backgroundColor 'white' - # availability object + # availability object (for weeks/months views) if availability.instance_of? Availability json.title availability.title(@title_filter) - if availability.available_type == 'event' - json.event_id availability.event.id - end - if availability.available_type == 'training' - json.training_id availability.trainings.first.id - end + json.event_id availability.event.id if availability.available_type == 'event' + json.training_id availability.trainings.first.id if availability.available_type == 'training' + json.space_id availability.spaces.first.id if availability.available_type == 'space' + json.machines_ids availability.machines.map(&:id) if availability.available_type == 'machines' json.available_type availability.available_type json.tag_ids availability.tag_ids json.tags availability.tags do |t| @@ -20,33 +20,17 @@ json.array!(@availabilities) do |availability| json.name t.name end - if availability.available_type == 'training' or availability.available_type == 'event' - json.borderColor trainings_events_border_color(availability) - if availability.is_reserved - json.is_reserved true - json.title "#{availability.title}' - #{t('trainings.i_ve_reserved')}" - elsif availability.full? - json.is_completed true - json.title "#{availability.title} - #{t('trainings.completed')}" - end - elsif availability.available_type == 'space' - complete = availability.slots.length >= availability.available_space_places - json.is_completed complete - json.borderColor availability_border_color(availability) - if complete - json.title "#{availability.title} - #{t('trainings.completed')}" - json.borderColor AvailabilityHelper::IS_FULL - end - if availability.is_reserved - json.is_reserved true - json.title "#{availability.title} - #{t('trainings.i_ve_reserved')}" - end - else - json.borderColor availability_border_color(availability) + json.is_completed availability.full? + json.is_reserved availability.is_reserved + json.borderColor availability_border_color(availability) + if availability.is_reserved && !availability.current_user_slots_reservations_ids.empty? + json.title "#{availability.title}' - #{t('trainings.i_ve_reserved')}" + elsif availability.full? + json.title "#{availability.title} - #{t('trainings.completed')}" + json.borderColor AvailabilityHelper::IS_FULL end - # slot object ( here => availability = slot ) - # -> machines / spaces + # slot object ( here => availability = slot ), for daily view elsif availability.instance_of? Slot json.title availability.title json.tag_ids availability.availability.tag_ids @@ -54,14 +38,20 @@ json.array!(@availabilities) do |availability| json.id t.id json.name t.name end - if availability.try(:machine) - json.machine_id availability.machine.id + json.is_reserved availability.is_reserved + json.is_completed availability.full? + if availability.availability.available_type == 'machines' + json.machine_ids availability.availability.machines.map(&:id) json.borderColor machines_slot_border_color(availability) - json.is_reserved availability.is_reserved - elsif availability.try(:space) - json.space_id availability.space.id + elsif availability.availability.available_type == 'space' + json.space_id availability.availability.space.first.id json.borderColor space_slot_border_color(availability) - json.is_completed availability.full? + elsif availability.availability.available_type == 'training' + json.training_id availability.availability.trainings.first.id + json.borderColor trainings_events_border_color(availability) + elsif availability.availability.available_type == 'event' + json.event_id availability.availability.event.id + json.borderColor trainings_events_border_color(availability) else json.title 'Unknown slot' end diff --git a/test/fixtures/availabilities.yml b/test/fixtures/availabilities.yml index 70ba0eb65..a97e96ccb 100644 --- a/test/fixtures/availabilities.yml +++ b/test/fixtures/availabilities.yml @@ -1,8 +1,8 @@ availability_1: id: 1 - start_at: <%= DateTime.current.utc.change({hour: 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= DateTime.current.utc.change({hour: 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= DateTime.current.utc.change({:hour => 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= DateTime.current.utc.change({:hour => 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> available_type: training created_at: 2016-04-04 15:24:01.517486000 Z updated_at: 2016-04-04 15:24:01.517486000 Z @@ -11,8 +11,8 @@ availability_1: availability_2: id: 2 - start_at: <%= (DateTime.current + 1.day).utc.change({hour: 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 1.day).utc.change({hour: 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 1.day).utc.change({:hour => 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 1.day).utc.change({:hour => 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> available_type: training created_at: 2016-04-04 15:24:09.169364000 Z updated_at: 2016-04-04 15:24:09.169364000 Z @@ -21,8 +21,8 @@ availability_2: availability_3: id: 3 - start_at: <%= DateTime.current.utc.change({hour: 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= DateTime.current.utc.change({hour: 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= DateTime.current.utc.change({:hour => 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= DateTime.current.utc.change({:hour => 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> available_type: machines created_at: 2016-04-04 15:24:27.587583000 Z updated_at: 2016-04-04 15:24:27.587583000 Z @@ -31,8 +31,8 @@ availability_3: availability_4: id: 4 - start_at: <%= (DateTime.current + 1.day).utc.change({hour: 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 1.day).utc.change({hour: 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 1.day).utc.change({:hour => 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 1.day).utc.change({:hour => 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> available_type: machines created_at: 2016-04-04 15:24:44.044908000 Z updated_at: 2016-04-04 15:24:44.044908000 Z @@ -41,8 +41,8 @@ availability_4: availability_5: id: 5 - start_at: <%= (DateTime.current + 2.day).utc.change({hour: 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 2.day).utc.change({hour: 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 2.day).utc.change({:hour => 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 2.day).utc.change({:hour => 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> available_type: machines created_at: 2016-04-04 15:25:48.584444000 Z updated_at: 2016-04-04 15:25:48.584444000 Z @@ -51,8 +51,8 @@ availability_5: availability_6: id: 6 - start_at: <%= (DateTime.current + 3.day).utc.change({hour: 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 3.day).utc.change({hour: 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 3.day).utc.change({:hour => 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 3.day).utc.change({:hour => 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> available_type: machines created_at: 2016-04-04 15:26:17.953216000 Z updated_at: 2016-04-04 15:26:17.953216000 Z @@ -61,8 +61,8 @@ availability_6: availability_7: id: 7 - start_at: <%= (DateTime.current + 3.day).utc.change({hour: 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 3.day).utc.change({hour: 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 3.day).utc.change({:hour => 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 3.day).utc.change({:hour => 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> available_type: machines created_at: 2016-04-04 15:26:39.278627000 Z updated_at: 2016-04-04 15:26:39.278627000 Z @@ -71,8 +71,8 @@ availability_7: availability_8: id: 8 - start_at: <%= (DateTime.current + 2.day).utc.change({hour: 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 2.day).utc.change({hour: 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 2.day).utc.change({:hour => 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 2.day).utc.change({:hour => 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> available_type: training created_at: 2016-04-04 15:26:49.572724000 Z updated_at: 2016-04-04 15:26:49.572724000 Z @@ -132,8 +132,8 @@ availability_13: availability_14: id: 14 - start_at: <%= 20.days.from_now.utc.change({hour: 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 20.days.from_now.utc.change({hour: 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 20.days.from_now.utc.change({:hour => 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 20.days.from_now.utc.change({:hour => 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> available_type: machines created_at: 2016-04-04 15:44:04.023557000 Z updated_at: 2016-04-04 15:44:04.023557000 Z @@ -142,8 +142,8 @@ availability_14: availability_15: id: 15 - start_at: <%= 40.days.from_now.utc.change({hour: 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 40.days.from_now.utc.change({hour: 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 40.days.from_now.utc.change({:hour => 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 40.days.from_now.utc.change({:hour => 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> available_type: machines created_at: 2016-04-04 15:44:04.023557000 Z updated_at: 2016-04-04 15:44:04.023557000 Z @@ -152,8 +152,8 @@ availability_15: availability_16: id: 16 - start_at: <%= 80.days.from_now.utc.change({hour: 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 80.days.from_now.utc.change({hour: 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 80.days.from_now.utc.change({:hour => 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 80.days.from_now.utc.change({:hour => 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> available_type: machines created_at: 2016-04-04 15:44:04.023557000 Z updated_at: 2016-04-04 15:44:04.023557000 Z @@ -162,9 +162,9 @@ availability_16: availability_17: id: 17 - start_at: <%= 10.days.from_now.utc.change({hour: 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 12.days.from_now.utc.change({hour: 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - available_type: machines + start_at: <%= 10.days.from_now.utc.change({:hour => 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 12.days.from_now.utc.change({:hour => 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + available_type: event created_at: 2016-04-04 15:44:04.023557000 Z updated_at: 2016-04-04 15:44:04.023557000 Z nb_total_places: @@ -172,8 +172,8 @@ availability_17: availability_18: id: 18 - start_at: <%= 2.days.from_now.utc.change({hour: 8}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 2.days.from_now.utc.change({hour: 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 2.days.from_now.utc.change({:hour => 8}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 2.days.from_now.utc.change({:hour => 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> available_type: space created_at: 2017-02-15 15:53:35.154433000 Z updated_at: 2017-02-15 15:53:35.154433000 Z @@ -182,10 +182,20 @@ availability_18: availability_19: id: 19 - start_at: <%= 1.day.from_now.utc.change({hour: 8}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 1.day.from_now.utc.change({hour: 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 1.day.from_now.utc.change({:hour => 8}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 1.day.from_now.utc.change({:hour => 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> available_type: machines created_at: 2017-02-15 15:53:35.154433000 Z updated_at: 2017-02-15 15:53:35.154433000 Z nb_total_places: destroying: false + +availability_20: + id: 20 + start_at: <%= 10.days.ago.utc.change({:hour => 8}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 10.days.ago.utc.change({:hour => 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + available_type: training + created_at: 2022-07-18 12:38:21.616510000 Z + updated_at: 2022-07-18 12:38:21.616510000 Z + nb_total_places: 5 + destroying: false diff --git a/test/fixtures/invoices.yml b/test/fixtures/invoices.yml index 4fbc79153..2fd5ea166 100644 --- a/test/fixtures/invoices.yml +++ b/test/fixtures/invoices.yml @@ -19,6 +19,7 @@ invoice_1: invoicing_profile_id: 3 operator_profile_id: 3 statistic_profile_id: 3 + invoice_2: id: 2 total: 2000 @@ -39,6 +40,7 @@ invoice_2: invoicing_profile_id: 4 operator_profile_id: 1 statistic_profile_id: 4 + invoice_3: id: 3 total: 3000 @@ -59,6 +61,7 @@ invoice_3: invoicing_profile_id: 7 operator_profile_id: 1 statistic_profile_id: 7 + invoice_4: id: 4 total: 0 @@ -79,6 +82,7 @@ invoice_4: invoicing_profile_id: 7 operator_profile_id: 1 statistic_profile_id: 7 + invoice_5: id: 5 total: 1500 @@ -99,6 +103,7 @@ invoice_5: invoicing_profile_id: 3 operator_profile_id: 1 statistic_profile_id: 3 + invoice_6: id: 6 total: 3000 diff --git a/test/fixtures/invoicing_profiles.yml b/test/fixtures/invoicing_profiles.yml index 626c047bb..ae29e2035 100644 --- a/test/fixtures/invoicing_profiles.yml +++ b/test/fixtures/invoicing_profiles.yml @@ -60,3 +60,10 @@ proudhon: first_name: Pierre-Joseph last_name: Proudhon email: pj.proudhon@la-propriete.org + +acamus: + id: 10 + user_id: 10 + first_name: Albert + last_name: Camus + email: albert.camus@letranger.org diff --git a/test/fixtures/payment_gateway_objects.yml b/test/fixtures/payment_gateway_objects.yml index 3dd7fbc88..29d5ea6b0 100644 --- a/test/fixtures/payment_gateway_objects.yml +++ b/test/fixtures/payment_gateway_objects.yml @@ -208,3 +208,25 @@ pgo30: item_type: PaymentSchedule item_id: 12 payment_gateway_object_id: 29 + +pgo31: + id: 31 + gateway_object_id: fakefakefakefake + gateway_object_type: PayZen::Order + item_type: PaymentSchedule + item_id: 13 + +pgo32: + id: 32 + gateway_object_id: fakefakefakefake + gateway_object_type: PayZen::Token + item_type: PaymentSchedule + item_id: 13 + +pgo33: + id: 33 + gateway_object_id: fakefakefakefake + gateway_object_type: PayZen::Subscription + item_type: PaymentSchedule + item_id: 13 + payment_gateway_object_id: 32 diff --git a/test/fixtures/payment_schedule_items.yml b/test/fixtures/payment_schedule_items.yml index e689becc7..d6506532f 100644 --- a/test/fixtures/payment_schedule_items.yml +++ b/test/fixtures/payment_schedule_items.yml @@ -166,3 +166,172 @@ payment_schedule_item_116: footprint: 9b162c2b342d8c82e9163202a22a405b879d4b2ad2409a61ad10942f743bc576 created_at: '2021-06-14 12:24:45.882343' updated_at: '2021-06-14 12:24:45.884709' + +payment_schedule_item_117: + id: 117 + amount: 9474 + due_date: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + state: paid + details: '{"recurring": 9466, "adjustment": 8, "other_items": 0}' + payment_method: card + client_secret: + payment_schedule_id: 13 + invoice_id: + footprint: fakefakefakefakefakefake + created_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + updated_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + +payment_schedule_item_118: + id: 118 + amount: 9466 + due_date: <%= 8.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + state: paid + details: '{"recurring": 9466}' + payment_method: card + client_secret: + payment_schedule_id: 13 + invoice_id: + footprint: fakefakefakefakefakefake + created_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + updated_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + + +payment_schedule_item_119: + id: 119 + amount: 9466 + due_date: <%= 7.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + state: paid + details: '{"recurring": 9466}' + payment_method: card + client_secret: + payment_schedule_id: 13 + invoice_id: + footprint: fakefakefakefakefakefake + created_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + updated_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + +payment_schedule_item_120: + id: 120 + amount: 9466 + due_date: <%= 6.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + state: paid + details: '{"recurring": 9466}' + payment_method: card + client_secret: + payment_schedule_id: 13 + invoice_id: + footprint: fakefakefakefakefakefake + created_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + updated_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + +payment_schedule_item_121: + id: 121 + amount: 9466 + due_date: <%= 5.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + state: paid + details: '{"recurring": 9466}' + payment_method: card + client_secret: + payment_schedule_id: 13 + invoice_id: + footprint: fakefakefakefakefakefake + created_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + updated_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + +payment_schedule_item_122: + id: 122 + amount: 9466 + due_date: <%= 4.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + state: paid + details: '{"recurring": 9466}' + payment_method: card + client_secret: + payment_schedule_id: 13 + invoice_id: + footprint: fakefakefakefakefakefake + created_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + updated_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + +payment_schedule_item_123: + id: 123 + amount: 9466 + due_date: <%= 3.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + state: paid + details: '{"recurring": 9466}' + payment_method: card + client_secret: + payment_schedule_id: 13 + invoice_id: + footprint: fakefakefakefakefakefake + created_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + updated_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + +payment_schedule_item_124: + id: 124 + amount: 9466 + due_date: <%= 2.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + state: paid + details: '{"recurring": 9466}' + payment_method: card + client_secret: + payment_schedule_id: 13 + invoice_id: + footprint: fakefakefakefakefakefake + created_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + updated_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + +payment_schedule_item_125: + id: 125 + amount: 9466 + due_date: <%= 1.month.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + state: paid + details: '{"recurring": 9466}' + payment_method: card + client_secret: + payment_schedule_id: 13 + invoice_id: + footprint: fakefakefakefakefakefake + created_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + updated_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + +payment_schedule_item_126: + id: 126 + amount: 9466 + due_date: <%= DateTime.current.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + state: new + details: '{"recurring": 9466}' + payment_method: + client_secret: + payment_schedule_id: 13 + invoice_id: + footprint: fakefakefakefakefakefake + created_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + updated_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + +payment_schedule_item_127: + id: 127 + amount: 9466 + due_date: <%= 1.month.from_now.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + state: new + details: '{"recurring": 9466}' + payment_method: + client_secret: + payment_schedule_id: 13 + invoice_id: + footprint: fakefakefakefakefakefake + created_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + updated_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + +payment_schedule_item_128: + id: 128 + amount: 9466 + due_date: <%= 2.months.from_now.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + state: new + details: '{"recurring": 9466}' + payment_method: + client_secret: + payment_schedule_id: 13 + invoice_id: + footprint: fakefakefakefakefakefake + created_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + updated_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> diff --git a/test/fixtures/payment_schedule_objects.yml b/test/fixtures/payment_schedule_objects.yml index 4a366c042..78b92dc18 100644 --- a/test/fixtures/payment_schedule_objects.yml +++ b/test/fixtures/payment_schedule_objects.yml @@ -1,4 +1,4 @@ -payment_schedule_oject_10: +payment_schedule_object_10: id: 10 object_type: Subscription object_id: 5 @@ -7,3 +7,13 @@ payment_schedule_oject_10: footprint: a1ef3a0c3abac7e02bc11193458c0d1e90a5acf290c9e3b4e7c049a7efcbeb30 created_at: '2021-06-14 12:24:45.890373' updated_at: '2021-06-14 12:24:45.894701' + +payment_schedule_object_11: + id: 11 + object_type: Subscription + object_id: 6 + payment_schedule_id: 13 + main: true + footprint: fakefakefakefakefakefake + created_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + updated_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> diff --git a/test/fixtures/payment_schedules.yml b/test/fixtures/payment_schedules.yml index 7ccecb8b6..ba981efbf 100644 --- a/test/fixtures/payment_schedules.yml +++ b/test/fixtures/payment_schedules.yml @@ -13,3 +13,19 @@ payment_schedule_12: operator_profile_id: 1 created_at: '2021-06-14 12:24:45.843714' updated_at: '2021-06-14 12:24:45.908386' + +payment_schedule_13: + id: 13 + total: 180000 + reference: <%= 9.months.ago.utc.strftime('%y%m00310/E') %> + payment_method: card + wallet_amount: + wallet_transaction_id: + coupon_id: + footprint: fakefakefakefakefakefake + environment: development + invoicing_profile_id: 10 + statistic_profile_id: 10 + operator_profile_id: 10 + created_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + updated_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> diff --git a/test/fixtures/profiles.yml b/test/fixtures/profiles.yml index 439ba2875..3d7434e38 100644 --- a/test/fixtures/profiles.yml +++ b/test/fixtures/profiles.yml @@ -97,3 +97,14 @@ profile_9: software_mastered: created_at: 2020-06-15 18:03:06.553623000 Z updated_at: 2021-06-14 15:51:39.729052000 Z + +profile_10: + id: 10 + user_id: 10 + first_name: Albert + last_name: Camus + phone: '0752145796' + interest: écriture, philosophie + software_mastered: + created_at: 1913-11-07 07:01:51.498120 + updated_at: 1960-01-04 17:05:09.219841 diff --git a/test/fixtures/slots.yml b/test/fixtures/slots.yml index b5042c3e4..febf5eb03 100644 --- a/test/fixtures/slots.yml +++ b/test/fixtures/slots.yml @@ -17,240 +17,240 @@ slot_2: slot_9: id: 9 - start_at: <%= DateTime.current.utc.change({hour: 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= DateTime.current.utc.change({hour: 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= DateTime.current.utc.change({:hour => 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= DateTime.current.utc.change({:hour => 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.880751' updated_at: '2022-07-12 15:18:43.880751' availability_id: 3 slot_10: id: 10 - start_at: <%= DateTime.current.utc.change({hour: 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= DateTime.current.utc.change({hour: 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= DateTime.current.utc.change({:hour => 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= DateTime.current.utc.change({:hour => 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.882957' updated_at: '2022-07-12 15:18:43.882957' availability_id: 3 slot_11: id: 11 - start_at: <%= DateTime.current.utc.change({hour: 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= DateTime.current.utc.change({hour: 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= DateTime.current.utc.change({:hour => 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= DateTime.current.utc.change({:hour => 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.884691' updated_at: '2022-07-12 15:18:43.884691' availability_id: 3 slot_12: id: 12 - start_at: <%= DateTime.current.utc.change({hour: 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= DateTime.current.utc.change({hour: 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= DateTime.current.utc.change({:hour => 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= DateTime.current.utc.change({:hour => 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.886431' updated_at: '2022-07-12 15:18:43.886431' availability_id: 3 slot_13: id: 13 - start_at: <%= DateTime.current.utc.change({hour: 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= DateTime.current.utc.change({hour: 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= DateTime.current.utc.change({:hour => 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= DateTime.current.utc.change({:hour => 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.888074' updated_at: '2022-07-12 15:18:43.888074' availability_id: 3 slot_14: id: 14 - start_at: <%= DateTime.current.utc.change({hour: 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= DateTime.current.utc.change({hour: 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= DateTime.current.utc.change({:hour => 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= DateTime.current.utc.change({:hour => 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.889691' updated_at: '2022-07-12 15:18:43.889691' availability_id: 3 slot_15: id: 15 - start_at: <%= (DateTime.current + 1.day).utc.change({hour: 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 1.day).utc.change({hour: 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 1.day).utc.change({:hour => 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 1.day).utc.change({:hour => 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.893096' updated_at: '2022-07-12 15:18:43.893096' availability_id: 4 slot_16: id: 16 - start_at: <%= (DateTime.current + 1.day).utc.change({hour: 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 1.day).utc.change({hour: 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 1.day).utc.change({:hour => 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 1.day).utc.change({:hour => 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.894777' updated_at: '2022-07-12 15:18:43.894777' availability_id: 4 slot_17: id: 17 - start_at: <%= (DateTime.current + 1.day).utc.change({hour: 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 1.day).utc.change({hour: 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 1.day).utc.change({:hour => 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 1.day).utc.change({:hour => 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.896423' updated_at: '2022-07-12 15:18:43.896423' availability_id: 4 slot_18: id: 18 - start_at: <%= (DateTime.current + 1.day).utc.change({hour: 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 1.day).utc.change({hour: 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 1.day).utc.change({:hour => 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 1.day).utc.change({:hour => 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.898021' updated_at: '2022-07-12 15:18:43.898021' availability_id: 4 slot_19: id: 19 - start_at: <%= (DateTime.current + 1.day).utc.change({hour: 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 1.day).utc.change({hour: 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 1.day).utc.change({:hour => 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 1.day).utc.change({:hour => 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.899592' updated_at: '2022-07-12 15:18:43.899592' availability_id: 4 slot_20: id: 20 - start_at: <%= (DateTime.current + 1.day).utc.change({hour: 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 1.day).utc.change({hour: 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 1.day).utc.change({:hour => 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 1.day).utc.change({:hour => 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.900938' updated_at: '2022-07-12 15:18:43.900938' availability_id: 4 slot_21: id: 21 - start_at: <%= (DateTime.current + 2.day).utc.change({hour: 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 2.day).utc.change({hour: 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 2.day).utc.change({:hour => 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 2.day).utc.change({:hour => 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.904013' updated_at: '2022-07-12 15:18:43.904013' availability_id: 5 slot_22: id: 22 - start_at: <%= (DateTime.current + 2.day).utc.change({hour: 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 2.day).utc.change({hour: 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 2.day).utc.change({:hour => 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 2.day).utc.change({:hour => 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.905470' updated_at: '2022-07-12 15:18:43.905470' availability_id: 5 slot_23: id: 23 - start_at: <%= (DateTime.current + 2.day).utc.change({hour: 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 2.day).utc.change({hour: 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 2.day).utc.change({:hour => 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 2.day).utc.change({:hour => 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.907030' updated_at: '2022-07-12 15:18:43.907030' availability_id: 5 slot_24: id: 24 - start_at: <%= (DateTime.current + 2.day).utc.change({hour: 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 2.day).utc.change({hour: 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 2.day).utc.change({:hour => 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 2.day).utc.change({:hour => 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.908585' updated_at: '2022-07-12 15:18:43.908585' availability_id: 5 slot_25: id: 25 - start_at: <%= (DateTime.current + 2.day).utc.change({hour: 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 2.day).utc.change({hour: 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 2.day).utc.change({:hour => 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 2.day).utc.change({:hour => 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.910138' updated_at: '2022-07-12 15:18:43.910138' availability_id: 5 slot_26: id: 26 - start_at: <%= (DateTime.current + 2.day).utc.change({hour: 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 2.day).utc.change({hour: 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 2.day).utc.change({:hour => 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 2.day).utc.change({:hour => 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.911643' updated_at: '2022-07-12 15:18:43.911643' availability_id: 5 slot_27: id: 27 - start_at: <%= (DateTime.current + 3.day).utc.change({hour: 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 3.day).utc.change({hour: 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 3.day).utc.change({:hour => 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 3.day).utc.change({:hour => 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.914664' updated_at: '2022-07-12 15:18:43.914664' availability_id: 6 slot_28: id: 28 - start_at: <%= (DateTime.current + 3.day).utc.change({hour: 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 3.day).utc.change({hour: 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 3.day).utc.change({:hour => 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 3.day).utc.change({:hour => 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.916047' updated_at: '2022-07-12 15:18:43.916047' availability_id: 6 slot_29: id: 29 - start_at: <%= (DateTime.current + 3.day).utc.change({hour: 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 3.day).utc.change({hour: 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 3.day).utc.change({:hour => 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 3.day).utc.change({:hour => 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.917304' updated_at: '2022-07-12 15:18:43.917304' availability_id: 6 slot_30: id: 30 - start_at: <%= (DateTime.current + 3.day).utc.change({hour: 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 3.day).utc.change({hour: 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 3.day).utc.change({:hour => 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 3.day).utc.change({:hour => 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.918798' updated_at: '2022-07-12 15:18:43.918798' availability_id: 6 slot_31: id: 31 - start_at: <%= (DateTime.current + 3.day).utc.change({hour: 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 3.day).utc.change({hour: 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 3.day).utc.change({:hour => 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 3.day).utc.change({:hour => 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.920194' updated_at: '2022-07-12 15:18:43.920194' availability_id: 6 slot_32: id: 32 - start_at: <%= (DateTime.current + 3.day).utc.change({hour: 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 3.day).utc.change({hour: 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 3.day).utc.change({:hour => 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 3.day).utc.change({:hour => 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.921662' updated_at: '2022-07-12 15:18:43.921662' availability_id: 6 slot_33: id: 33 - start_at: <%= (DateTime.current + 3.day).utc.change({hour: 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 3.day).utc.change({hour: 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 3.day).utc.change({:hour => 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 3.day).utc.change({:hour => 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.924285' updated_at: '2022-07-12 15:18:43.924285' availability_id: 7 slot_34: id: 34 - start_at: <%= (DateTime.current + 3.day).utc.change({hour: 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 3.day).utc.change({hour: 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 3.day).utc.change({:hour => 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 3.day).utc.change({:hour => 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.925669' updated_at: '2022-07-12 15:18:43.925669' availability_id: 7 slot_35: id: 35 - start_at: <%= (DateTime.current + 3.day).utc.change({hour: 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 3.day).utc.change({hour: 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 3.day).utc.change({:hour => 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 3.day).utc.change({:hour => 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.927038' updated_at: '2022-07-12 15:18:43.927038' availability_id: 7 slot_36: id: 36 - start_at: <%= (DateTime.current + 3.day).utc.change({hour: 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 3.day).utc.change({hour: 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 3.day).utc.change({:hour => 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 3.day).utc.change({:hour => 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.928407' updated_at: '2022-07-12 15:18:43.928407' availability_id: 7 slot_37: id: 37 - start_at: <%= (DateTime.current + 3.day).utc.change({hour: 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 3.day).utc.change({hour: 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 3.day).utc.change({:hour => 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 3.day).utc.change({:hour => 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.929907' updated_at: '2022-07-12 15:18:43.929907' availability_id: 7 slot_38: id: 38 - start_at: <%= (DateTime.current + 3.day).utc.change({hour: 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 3.day).utc.change({hour: 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 3.day).utc.change({:hour => 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 3.day).utc.change({:hour => 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.931295' updated_at: '2022-07-12 15:18:43.931295' availability_id: 7 @@ -297,680 +297,240 @@ slot_43: slot_44: id: 44 - start_at: <%= 20.days.from_now.utc.change({hour: 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 20.days.from_now.utc.change({hour: 7}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 20.days.from_now.utc.change({:hour => 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 20.days.from_now.utc.change({:hour => 7}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.942392' updated_at: '2022-07-12 15:18:43.942392' availability_id: 14 slot_45: id: 45 - start_at: <%= 20.days.from_now.utc.change({hour: 7}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 20.days.from_now.utc.change({hour: 8}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 20.days.from_now.utc.change({:hour => 7}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 20.days.from_now.utc.change({:hour => 8}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.943779' updated_at: '2022-07-12 15:18:43.943779' availability_id: 14 slot_46: id: 46 - start_at: <%= 20.days.from_now.utc.change({hour: 8}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 20.days.from_now.utc.change({hour: 9}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 20.days.from_now.utc.change({:hour => 8}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 20.days.from_now.utc.change({:hour => 9}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.945154' updated_at: '2022-07-12 15:18:43.945154' availability_id: 14 slot_47: id: 47 - start_at: <%= 20.days.from_now.utc.change({hour: 9}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 20.days.from_now.utc.change({hour: 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 20.days.from_now.utc.change({:hour => 9}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 20.days.from_now.utc.change({:hour => 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.946515' updated_at: '2022-07-12 15:18:43.946515' availability_id: 14 slot_48: id: 48 - start_at: <%= 40.days.from_now.utc.change({hour: 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 40.days.from_now.utc.change({hour: 7}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 40.days.from_now.utc.change({:hour => 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 40.days.from_now.utc.change({:hour => 7}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.949178' updated_at: '2022-07-12 15:18:43.949178' availability_id: 15 slot_49: id: 49 - start_at: <%= 40.days.from_now.utc.change({hour: 7}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 40.days.from_now.utc.change({hour: 8}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 40.days.from_now.utc.change({:hour => 7}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 40.days.from_now.utc.change({:hour => 8}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.950348' updated_at: '2022-07-12 15:18:43.950348' availability_id: 15 slot_50: id: 50 - start_at: <%= 40.days.from_now.utc.change({hour: 8}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 40.days.from_now.utc.change({hour: 9}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 40.days.from_now.utc.change({:hour => 8}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 40.days.from_now.utc.change({:hour => 9}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.951535' updated_at: '2022-07-12 15:18:43.951535' availability_id: 15 slot_51: id: 51 - start_at: <%= 40.days.from_now.utc.change({hour: 9}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 40.days.from_now.utc.change({hour: 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 40.days.from_now.utc.change({:hour => 9}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 40.days.from_now.utc.change({:hour => 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.952864' updated_at: '2022-07-12 15:18:43.952864' availability_id: 15 slot_52: id: 52 - start_at: <%= 80.days.from_now.utc.change({hour: 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 80.days.from_now.utc.change({hour: 7}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 80.days.from_now.utc.change({:hour => 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 80.days.from_now.utc.change({:hour => 7}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.955443' updated_at: '2022-07-12 15:18:43.955443' availability_id: 16 slot_53: id: 53 - start_at: <%= 80.days.from_now.utc.change({hour: 7}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 80.days.from_now.utc.change({hour: 8}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 80.days.from_now.utc.change({:hour => 7}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 80.days.from_now.utc.change({:hour => 8}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.956657' updated_at: '2022-07-12 15:18:43.956657' availability_id: 16 slot_54: id: 54 - start_at: <%= 80.days.from_now.utc.change({hour: 8}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 80.days.from_now.utc.change({hour: 9}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 80.days.from_now.utc.change({:hour => 8}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 80.days.from_now.utc.change({:hour => 9}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.957811' updated_at: '2022-07-12 15:18:43.957811' availability_id: 16 slot_55: id: 55 - start_at: <%= 80.days.from_now.utc.change({hour: 9}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 80.days.from_now.utc.change({hour: 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 80.days.from_now.utc.change({:hour => 9}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 80.days.from_now.utc.change({:hour => 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.959063' updated_at: '2022-07-12 15:18:43.959063' availability_id: 16 slot_56: id: 56 - start_at: <%= 10.days.from_now.utc.change({hour: 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 10.days.from_now.utc.change({hour: 11}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 10.days.from_now.utc.change({:hour => 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 12.days.from_now.utc.change({:hour => 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:43.961319' updated_at: '2022-07-12 15:18:43.961319' availability_id: 17 -slot_57: - id: 57 - start_at: <%= 10.days.from_now.utc.change({hour: 11}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 10.days.from_now.utc.change({hour: 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.962492' - updated_at: '2022-07-12 15:18:43.962492' - availability_id: 17 - -slot_58: - id: 58 - start_at: <%= 10.days.from_now.utc.change({hour: 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 10.days.from_now.utc.change({hour: 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.963665' - updated_at: '2022-07-12 15:18:43.963665' - availability_id: 17 - -slot_59: - id: 59 - start_at: <%= 10.days.from_now.utc.change({hour: 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 10.days.from_now.utc.change({hour: 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.964853' - updated_at: '2022-07-12 15:18:43.964853' - availability_id: 17 - -slot_60: - id: 60 - start_at: <%= 10.days.from_now.utc.change({hour: 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 10.days.from_now.utc.change({hour: 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.966003' - updated_at: '2022-07-12 15:18:43.966003' - availability_id: 17 - -slot_61: - id: 61 - start_at: <%= 10.days.from_now.utc.change({hour: 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 10.days.from_now.utc.change({hour: 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.967147' - updated_at: '2022-07-12 15:18:43.967147' - availability_id: 17 - -slot_62: - id: 62 - start_at: <%= 10.days.from_now.utc.change({hour: 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 10.days.from_now.utc.change({hour: 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.968371' - updated_at: '2022-07-12 15:18:43.968371' - availability_id: 17 - -slot_63: - id: 63 - start_at: <%= 10.days.from_now.utc.change({hour: 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 10.days.from_now.utc.change({hour: 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.969636' - updated_at: '2022-07-12 15:18:43.969636' - availability_id: 17 - -slot_64: - id: 64 - start_at: <%= 10.days.from_now.utc.change({hour: 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 10.days.from_now.utc.change({hour: 19}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.970899' - updated_at: '2022-07-12 15:18:43.970899' - availability_id: 17 - -slot_65: - id: 65 - start_at: <%= 10.days.from_now.utc.change({hour: 19}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 10.days.from_now.utc.change({hour: 20}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.972292' - updated_at: '2022-07-12 15:18:43.972292' - availability_id: 17 - -slot_66: - id: 66 - start_at: <%= 10.days.from_now.utc.change({hour: 20}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 10.days.from_now.utc.change({hour: 21}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.973726' - updated_at: '2022-07-12 15:18:43.973726' - availability_id: 17 - -slot_67: - id: 67 - start_at: <%= 10.days.from_now.utc.change({hour: 21}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 10.days.from_now.utc.change({hour: 22}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.975239' - updated_at: '2022-07-12 15:18:43.975239' - availability_id: 17 - -slot_68: - id: 68 - start_at: <%= 10.days.from_now.utc.change({hour: 22}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 10.days.from_now.utc.change({hour: 23}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.976671' - updated_at: '2022-07-12 15:18:43.976671' - availability_id: 17 - -slot_69: - id: 69 - start_at: <%= 10.days.from_now.utc.change({hour: 23}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 11.days.from_now.utc.change({hour: 0}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.978191' - updated_at: '2022-07-12 15:18:43.978191' - availability_id: 17 - -slot_70: - id: 70 - start_at: <%= 11.days.from_now.utc.change({hour: 0}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 11.days.from_now.utc.change({hour: 1}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.979560' - updated_at: '2022-07-12 15:18:43.979560' - availability_id: 17 - -slot_71: - id: 71 - start_at: <%= 11.days.from_now.utc.change({hour: 1}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 11.days.from_now.utc.change({hour: 2}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.980799' - updated_at: '2022-07-12 15:18:43.980799' - availability_id: 17 - -slot_72: - id: 72 - start_at: <%= 11.days.from_now.utc.change({hour: 2}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 11.days.from_now.utc.change({hour: 3}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.982141' - updated_at: '2022-07-12 15:18:43.982141' - availability_id: 17 - -slot_73: - id: 73 - start_at: <%= 11.days.from_now.utc.change({hour: 3}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 11.days.from_now.utc.change({hour: 4}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.983501' - updated_at: '2022-07-12 15:18:43.983501' - availability_id: 17 - -slot_74: - id: 74 - start_at: <%= 11.days.from_now.utc.change({hour: 4}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 11.days.from_now.utc.change({hour: 5}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.984866' - updated_at: '2022-07-12 15:18:43.984866' - availability_id: 17 - -slot_75: - id: 75 - start_at: <%= 11.days.from_now.utc.change({hour: 5}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 11.days.from_now.utc.change({hour: 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.986257' - updated_at: '2022-07-12 15:18:43.986257' - availability_id: 17 - -slot_76: - id: 76 - start_at: <%= 11.days.from_now.utc.change({hour: 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 11.days.from_now.utc.change({hour: 7}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.987589' - updated_at: '2022-07-12 15:18:43.987589' - availability_id: 17 - -slot_77: - id: 77 - start_at: <%= 11.days.from_now.utc.change({hour: 7}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 11.days.from_now.utc.change({hour: 8}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.988913' - updated_at: '2022-07-12 15:18:43.988913' - availability_id: 17 - -slot_78: - id: 78 - start_at: <%= 11.days.from_now.utc.change({hour: 8}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 11.days.from_now.utc.change({hour: 9}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.990191' - updated_at: '2022-07-12 15:18:43.990191' - availability_id: 17 - -slot_79: - id: 79 - start_at: <%= 11.days.from_now.utc.change({hour: 9}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 11.days.from_now.utc.change({hour: 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.991488' - updated_at: '2022-07-12 15:18:43.991488' - availability_id: 17 - -slot_80: - id: 80 - start_at: <%= 11.days.from_now.utc.change({hour: 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 11.days.from_now.utc.change({hour: 11}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.992988' - updated_at: '2022-07-12 15:18:43.992988' - availability_id: 17 - -slot_81: - id: 81 - start_at: <%= 11.days.from_now.utc.change({hour: 11}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 11.days.from_now.utc.change({hour: 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.994311' - updated_at: '2022-07-12 15:18:43.994311' - availability_id: 17 - -slot_82: - id: 82 - start_at: <%= 11.days.from_now.utc.change({hour: 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 11.days.from_now.utc.change({hour: 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.995812' - updated_at: '2022-07-12 15:18:43.995812' - availability_id: 17 - -slot_83: - id: 83 - start_at: <%= 11.days.from_now.utc.change({hour: 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 11.days.from_now.utc.change({hour: 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.997242' - updated_at: '2022-07-12 15:18:43.997242' - availability_id: 17 - -slot_84: - id: 84 - start_at: <%= 11.days.from_now.utc.change({hour: 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 11.days.from_now.utc.change({hour: 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:43.998733' - updated_at: '2022-07-12 15:18:43.998733' - availability_id: 17 - -slot_85: - id: 85 - start_at: <%= 11.days.from_now.utc.change({hour: 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 11.days.from_now.utc.change({hour: 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:44.000009' - updated_at: '2022-07-12 15:18:44.000009' - availability_id: 17 - -slot_86: - id: 86 - start_at: <%= 11.days.from_now.utc.change({hour: 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 11.days.from_now.utc.change({hour: 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:44.001315' - updated_at: '2022-07-12 15:18:44.001315' - availability_id: 17 - -slot_87: - id: 87 - start_at: <%= 11.days.from_now.utc.change({hour: 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 11.days.from_now.utc.change({hour: 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:44.002961' - updated_at: '2022-07-12 15:18:44.002961' - availability_id: 17 - -slot_88: - id: 88 - start_at: <%= 11.days.from_now.utc.change({hour: 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 11.days.from_now.utc.change({hour: 19}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:44.004321' - updated_at: '2022-07-12 15:18:44.004321' - availability_id: 17 - -slot_89: - id: 89 - start_at: <%= 11.days.from_now.utc.change({hour: 19}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 11.days.from_now.utc.change({hour: 20}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:44.005828' - updated_at: '2022-07-12 15:18:44.005828' - availability_id: 17 - -slot_90: - id: 90 - start_at: <%= 11.days.from_now.utc.change({hour: 20}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 11.days.from_now.utc.change({hour: 21}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:44.007295' - updated_at: '2022-07-12 15:18:44.007295' - availability_id: 17 - -slot_91: - id: 91 - start_at: <%= 11.days.from_now.utc.change({hour: 21}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 11.days.from_now.utc.change({hour: 22}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:44.008631' - updated_at: '2022-07-12 15:18:44.008631' - availability_id: 17 - -slot_92: - id: 92 - start_at: <%= 11.days.from_now.utc.change({hour: 22}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 11.days.from_now.utc.change({hour: 23}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:44.010249' - updated_at: '2022-07-12 15:18:44.010249' - availability_id: 17 - -slot_93: - id: 93 - start_at: <%= 11.days.from_now.utc.change({hour: 23}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 12.days.from_now.utc.change({hour: 0}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:44.011771' - updated_at: '2022-07-12 15:18:44.011771' - availability_id: 17 - -slot_94: - id: 94 - start_at: <%= 12.days.from_now.utc.change({hour: 0}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 12.days.from_now.utc.change({hour: 1}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:44.013133' - updated_at: '2022-07-12 15:18:44.013133' - availability_id: 17 - -slot_95: - id: 95 - start_at: <%= 12.days.from_now.utc.change({hour: 1}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 12.days.from_now.utc.change({hour: 2}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:44.014419' - updated_at: '2022-07-12 15:18:44.014419' - availability_id: 17 - -slot_96: - id: 96 - start_at: <%= 12.days.from_now.utc.change({hour: 2}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 12.days.from_now.utc.change({hour: 3}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:44.015693' - updated_at: '2022-07-12 15:18:44.015693' - availability_id: 17 - -slot_97: - id: 97 - start_at: <%= 12.days.from_now.utc.change({hour: 3}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 12.days.from_now.utc.change({hour: 4}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:44.016849' - updated_at: '2022-07-12 15:18:44.016849' - availability_id: 17 - -slot_98: - id: 98 - start_at: <%= 12.days.from_now.utc.change({hour: 4}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 12.days.from_now.utc.change({hour: 5}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:44.018072' - updated_at: '2022-07-12 15:18:44.018072' - availability_id: 17 - -slot_99: - id: 99 - start_at: <%= 12.days.from_now.utc.change({hour: 5}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 12.days.from_now.utc.change({hour: 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:44.019364' - updated_at: '2022-07-12 15:18:44.019364' - availability_id: 17 - -slot_100: - id: 100 - start_at: <%= 12.days.from_now.utc.change({hour: 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 12.days.from_now.utc.change({hour: 7}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:44.020527' - updated_at: '2022-07-12 15:18:44.020527' - availability_id: 17 - -slot_101: - id: 101 - start_at: <%= 12.days.from_now.utc.change({hour: 7}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 12.days.from_now.utc.change({hour: 8}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %>' - created_at: '2022-07-12 15:18:44.021871' - updated_at: '2022-07-12 15:18:44.021871' - availability_id: 17 - -slot_102: - id: 102 - start_at: <%= 12.days.from_now.utc.change({hour: 8}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 12.days.from_now.utc.change({hour: 9}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:44.023185' - updated_at: '2022-07-12 15:18:44.023185' - availability_id: 17 - -slot_103: - id: 103 - start_at: <%= 12.days.from_now.utc.change({hour: 9}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 12.days.from_now.utc.change({hour: 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:44.024405' - updated_at: '2022-07-12 15:18:44.024405' - availability_id: 17 - -slot_104: - id: 104 - start_at: <%= 12.days.from_now.utc.change({hour: 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 12.days.from_now.utc.change({hour: 11}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:44.025867' - updated_at: '2022-07-12 15:18:44.025867' - availability_id: 17 - -slot_105: - id: 105 - start_at: <%= 12.days.from_now.utc.change({hour: 11}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 12.days.from_now.utc.change({hour: 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:44.027282' - updated_at: '2022-07-12 15:18:44.027282' - availability_id: 17 - -slot_106: - id: 106 - start_at: <%= 12.days.from_now.utc.change({hour: 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 12.days.from_now.utc.change({hour: 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:44.028605' - updated_at: '2022-07-12 15:18:44.028605' - availability_id: 17 - -slot_107: - id: 107 - start_at: <%= 12.days.from_now.utc.change({hour: 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 12.days.from_now.utc.change({hour: 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:44.029949' - updated_at: '2022-07-12 15:18:44.029949' - availability_id: 17 - -slot_108: - id: 108 - start_at: <%= 12.days.from_now.utc.change({hour: 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 12.days.from_now.utc.change({hour: 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:44.031298' - updated_at: '2022-07-12 15:18:44.031298' - availability_id: 17 - -slot_109: - id: 109 - start_at: <%= 12.days.from_now.utc.change({hour: 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 12.days.from_now.utc.change({hour: 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:44.032602' - updated_at: '2022-07-12 15:18:44.032602' - availability_id: 17 - -slot_110: - id: 110 - start_at: <%= 12.days.from_now.utc.change({hour: 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 12.days.from_now.utc.change({hour: 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:44.034111' - updated_at: '2022-07-12 15:18:44.034111' - availability_id: 17 - -slot_111: - id: 111 - start_at: <%= 12.days.from_now.utc.change({hour: 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 12.days.from_now.utc.change({hour: 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - created_at: '2022-07-12 15:18:44.035567' - updated_at: '2022-07-12 15:18:44.035567' - availability_id: 17 - slot_112: id: 112 - start_at: <%= 2.days.from_now.utc.change({hour: 8}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 2.days.from_now.utc.change({hour: 9}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 2.days.from_now.utc.change({:hour => 8}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 2.days.from_now.utc.change({:hour => 9}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:44.038089' updated_at: '2022-07-12 15:18:44.038089' availability_id: 18 slot_113: id: 113 - start_at: <%= 2.days.from_now.utc.change({hour: 9}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 2.days.from_now.utc.change({hour: 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 2.days.from_now.utc.change({:hour => 9}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 2.days.from_now.utc.change({:hour => 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:44.039392' updated_at: '2022-07-12 15:18:44.039392' availability_id: 18 slot_114: id: 114 - start_at: <%= 2.days.from_now.utc.change({hour: 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 2.days.from_now.utc.change({hour: 11}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 2.days.from_now.utc.change({:hour => 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 2.days.from_now.utc.change({:hour => 11}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:44.040522' updated_at: '2022-07-12 15:18:44.040522' availability_id: 18 slot_115: id: 115 - start_at: <%= 2.days.from_now.utc.change({hour: 11}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 2.days.from_now.utc.change({hour: 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 2.days.from_now.utc.change({:hour => 11}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 2.days.from_now.utc.change({:hour => 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:44.041937' updated_at: '2022-07-12 15:18:44.041937' availability_id: 18 slot_116: id: 116 - start_at: <%= 1.day.from_now.utc.change({hour: 8}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 1.day.from_now.utc.change({hour: 9}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 1.day.from_now.utc.change({:hour => 8}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 1.day.from_now.utc.change({:hour => 9}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:44.044421' updated_at: '2022-07-12 15:18:44.044421' availability_id: 19 slot_117: id: 117 - start_at: <%= 1.day.from_now.utc.change({hour: 9}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 1.day.from_now.utc.change({hour: 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 1.day.from_now.utc.change({:hour => 9}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 1.day.from_now.utc.change({:hour => 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:44.045689' updated_at: '2022-07-12 15:18:44.045689' availability_id: 19 slot_118: id: 118 - start_at: <%= 1.day.from_now.utc.change({hour: 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 1.day.from_now.utc.change({hour: 11}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 1.day.from_now.utc.change({:hour => 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 1.day.from_now.utc.change({:hour => 11}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:44.047009' updated_at: '2022-07-12 15:18:44.047009' availability_id: 19 slot_119: id: 119 - start_at: <%= 1.day.from_now.utc.change({hour: 11}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 1.day.from_now.utc.change({hour: 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 1.day.from_now.utc.change({:hour => 11}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 1.day.from_now.utc.change({:hour => 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:44.048272' updated_at: '2022-07-12 15:18:44.048272' availability_id: 19 slot_120: id: 120 - start_at: <%= 1.day.from_now.utc.change({hour: 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 1.day.from_now.utc.change({hour: 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 1.day.from_now.utc.change({:hour => 12}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 1.day.from_now.utc.change({:hour => 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:44.049599' updated_at: '2022-07-12 15:18:44.049599' availability_id: 19 slot_121: id: 121 - start_at: <%= 1.day.from_now.utc.change({hour: 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 1.day.from_now.utc.change({hour: 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 1.day.from_now.utc.change({:hour => 13}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 1.day.from_now.utc.change({:hour => 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:44.050947' updated_at: '2022-07-12 15:18:44.050947' availability_id: 19 slot_122: id: 122 - start_at: <%= 1.day.from_now.utc.change({hour: 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 1.day.from_now.utc.change({hour: 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 1.day.from_now.utc.change({:hour => 14}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 1.day.from_now.utc.change({:hour => 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:44.052817' updated_at: '2022-07-12 15:18:44.052817' availability_id: 19 slot_123: id: 123 - start_at: <%= 1.day.from_now.utc.change({hour: 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 1.day.from_now.utc.change({hour: 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 1.day.from_now.utc.change({:hour => 15}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 1.day.from_now.utc.change({:hour => 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:44.054966' updated_at: '2022-07-12 15:18:44.054966' availability_id: 19 slot_124: id: 124 - start_at: <%= 1.day.from_now.utc.change({hour: 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 1.day.from_now.utc.change({hour: 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 1.day.from_now.utc.change({:hour => 16}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 1.day.from_now.utc.change({:hour => 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:44.057217' updated_at: '2022-07-12 15:18:44.057217' availability_id: 19 slot_125: id: 125 - start_at: <%= 1.day.from_now.utc.change({hour: 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= 1.day.from_now.utc.change({hour: 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= 1.day.from_now.utc.change({:hour => 17}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 1.day.from_now.utc.change({:hour => 18}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:44.059135' updated_at: '2022-07-12 15:18:44.059135' availability_id: 19 slot_126: id: 126 - start_at: <%= DateTime.current.utc.change({hour: 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= DateTime.current.utc.change({hour: 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= DateTime.current.utc.change({:hour => 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= DateTime.current.utc.change({:hour => 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:44.061887' updated_at: '2022-07-12 15:18:44.061887' availability_id: 1 slot_127: id: 127 - start_at: <%= (DateTime.current + 1.day).utc.change({hour: 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 1.day).utc.change({hour: 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 1.day).utc.change({:hour => 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 1.day).utc.change({:hour => 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:44.063528' updated_at: '2022-07-12 15:18:44.063528' availability_id: 2 slot_128: id: 128 - start_at: <%= (DateTime.current + 2.day).utc.change({hour: 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> - end_at: <%= (DateTime.current + 2.day).utc.change({hour: 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + start_at: <%= (DateTime.current + 2.day).utc.change({:hour => 6}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= (DateTime.current + 2.day).utc.change({:hour => 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> created_at: '2022-07-12 15:18:44.065114' updated_at: '2022-07-12 15:18:44.065114' availability_id: 8 @@ -998,3 +558,11 @@ slot_131: created_at: '2022-07-12 15:18:44.069870' updated_at: '2022-07-12 15:18:44.069870' availability_id: 11 + +slot_132: + id: 132 + start_at: <%= 10.days.ago.utc.change({:hour => 8}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + end_at: <%= 10.days.ago.utc.change({:hour => 10}).strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + created_at: '2022-07-18 12:38:21.616510' + updated_at: '2022-07-18 12:38:21.616510' + availability_id: 20 diff --git a/test/fixtures/statistic_profiles.yml b/test/fixtures/statistic_profiles.yml index 3ecf17ddd..1cb959067 100644 --- a/test/fixtures/statistic_profiles.yml +++ b/test/fixtures/statistic_profiles.yml @@ -60,3 +60,10 @@ proudhon: gender: true birthday: 1809-01-15 group_id: 1 + +acamus: + id: 10 + user_id: 10 + gender: true + birthday: 1913-11-07 + group_id: 1 diff --git a/test/fixtures/subscriptions.yml b/test/fixtures/subscriptions.yml index 87b4fdcd4..711644d4c 100644 --- a/test/fixtures/subscriptions.yml +++ b/test/fixtures/subscriptions.yml @@ -45,3 +45,12 @@ subscription_5: updated_at: 2021-06-14 12:24:45.836045000 Z expiration_date: 2022-06-14 12:24:45.836045000 Z canceled_at: + +subscription_6: + id: 6 + plan_id: 4 + statistic_profile_id: 10 + created_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + updated_at: <%= 9.months.ago.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + expiration_date: <%= 3.months.from_now.utc.strftime('%Y-%m-%d %H:%M:%S.%9N Z') %> + canceled_at: diff --git a/test/fixtures/trainings_availabilities.yml b/test/fixtures/trainings_availabilities.yml index 0827e52de..90ba7736c 100644 --- a/test/fixtures/trainings_availabilities.yml +++ b/test/fixtures/trainings_availabilities.yml @@ -26,3 +26,10 @@ trainings_availability_4: availability_id: 12 created_at: 2020-07-22 10:09:41.841162000 Z updated_at: 2020-07-22 10:09:41.841162000 Z + +trainings_availability_5: + id: 5 + training_id: 2 + availability_id: 20 + created_at: 2020-07-22 10:09:41.841162000 Z + updated_at: 2020-07-22 10:09:41.841162000 Z diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml index 94b49105a..c98eaebec 100644 --- a/test/fixtures/users.yml +++ b/test/fixtures/users.yml @@ -285,3 +285,35 @@ user_9: auth_token: merged_at: is_allow_newsletter: true + +user_10: + id: 10 + username: acamus + email: albert.camus@letranger.org + encrypted_password: $2a$10$r85b9a2/BZvQsZRPVyhT2uuLnoLpUZ.ch8qca63yvuCn6kC4I2Jam + reset_password_token: + reset_password_sent_at: + remember_created_at: + sign_in_count: 10 + current_sign_in_at: 1960-01-01 11:04:02.566161 + last_sign_in_at: 1960-01-01 11:04:02.566161 + current_sign_in_ip: 177.92.140.29 + last_sign_in_ip: 177.92.140.29 + confirmation_token: + confirmed_at: 1931-11-08 14:29:01.441270 + confirmation_sent_at: 1931-11-07 07:01:51.498120 + unconfirmed_email: + failed_attempts: 0 + unlock_token: + locked_at: + created_at: 1913-11-07 07:01:51.498120 + updated_at: 1960-01-04 17:05:09.219841 + is_allow_contact: true + group_id: 1 + slug: acamus + is_active: true + provider: + uid: + auth_token: + merged_at: + is_allow_newsletter: true diff --git a/test/fixtures/wallets.yml b/test/fixtures/wallets.yml index 77ca99305..a6dc3514d 100644 --- a/test/fixtures/wallets.yml +++ b/test/fixtures/wallets.yml @@ -33,3 +33,7 @@ wallet_8: wallet_9: invoicing_profile_id: 9 amount: 0 + +wallet_10: + invoicing_profile_id: 10 + amount: 0 diff --git a/test/integration/availabilities/as_public_test.rb b/test/integration/availabilities/as_public_test.rb index 234944c4f..9d5e889ce 100644 --- a/test/integration/availabilities/as_public_test.rb +++ b/test/integration/availabilities/as_public_test.rb @@ -67,8 +67,8 @@ class Availabilities::AsPublicTest < ActionDispatch::IntegrationTest end test 'get public events availabilities' do - start_date = DateTime.parse('2016-04-18').to_date - end_date = DateTime.parse('2016-04-24').to_date + start_date = 8.days.from_now.to_date + end_date = 16.days.from_now.to_date get "/api/availabilities/public?start=#{start_date.to_s}&end=#{end_date.to_s}&timezone=Europe%2FParis&evt=true" @@ -100,4 +100,4 @@ class Availabilities::AsPublicTest < ActionDispatch::IntegrationTest def all_spaces Space.all.map { |m| "s%5B%5D=#{m.id}" }.join('&') end -end \ No newline at end of file +end diff --git a/test/integration/availabilities/as_user_test.rb b/test/integration/availabilities/as_user_test.rb index b53ddb478..aae9445a2 100644 --- a/test/integration/availabilities/as_user_test.rb +++ b/test/integration/availabilities/as_user_test.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require 'test_helper' + class Availabilities::AsUserTest < ActionDispatch::IntegrationTest setup do user = User.find_by(username: 'kdumas') diff --git a/test/integration/reservations/create_as_admin_test.rb b/test/integration/reservations/create_as_admin_test.rb index a13f6b588..25653b6be 100644 --- a/test/integration/reservations/create_as_admin_test.rb +++ b/test/integration/reservations/create_as_admin_test.rb @@ -229,7 +229,7 @@ class Reservations::CreateAsAdminTest < ActionDispatch::IntegrationTest reservation: { reservable_id: machine.id, reservable_type: machine.class.name, - sslots_reservations_attributes: [ + slots_reservations_attributes: [ { slot_id: availability.slots.first.id } diff --git a/test/services/availabilities_service_test.rb b/test/services/availabilities_service_test.rb new file mode 100644 index 000000000..7243885a8 --- /dev/null +++ b/test/services/availabilities_service_test.rb @@ -0,0 +1,94 @@ +# frozen_string_literal: true + +require 'test_helper' + +# Test the service returning the availabilities for the given resources +class AvailabilitiesServiceTest < ActiveSupport::TestCase + setup do + @no_subscription = User.find_by(username: 'jdupond') + @with_subscription = User.find_by(username: 'kdumas') + @with_1y_subscription = User.find_by(username: 'acamus') + @admin = User.find_by(username: 'admin') + end + + test 'no machines availabilities during given window' do + service = Availabilities::AvailabilitiesService.new(@no_subscription) + slots = service.machines(Machine.find(3), @no_subscription, { start: DateTime.current.beginning_of_day, end: 1.day.from_now.end_of_day }) + + assert_empty slots + end + + test 'no machines availabilities for user tags' do + service = Availabilities::AvailabilitiesService.new(@no_subscription) + slots = service.machines(Machine.find(3), @no_subscription, { start: 2.days.from_now.beginning_of_day, end: 4.days.from_now.end_of_day }) + + assert_empty slots + end + + test 'no past availabilities for members' do + service = Availabilities::AvailabilitiesService.new(@no_subscription) + slots = service.machines(Machine.find(2), @no_subscription, { start: DateTime.parse('2015-06-15').beginning_of_day, end: DateTime.parse('2015-06-15').end_of_day }) + + assert_empty slots + end + + test 'admin cannot see past availabilities further than 1 month' do + service = Availabilities::AvailabilitiesService.new(@admin) + slots = service.machines(Machine.find(2), @no_subscription, { start: DateTime.parse('2015-06-15').beginning_of_day, end: DateTime.parse('2015-06-15').end_of_day }) + + assert_empty slots + end + + test 'admin can see past availabilities in 1 month ago' do + service = Availabilities::AvailabilitiesService.new(@admin) + slots = service.trainings([Training.find(2)], @no_subscription, { start: 1.month.ago.beginning_of_day, end: 1.day.ago.end_of_day }) + + assert_not_empty slots + assert_equal Availability.find(20).slots.count, slots.count + assert_equal Availability.find(20).start_at, slots.first.start_at + assert_equal Availability.find(20).end_at, slots.first.end_at + end + + test 'machines availabilities' do + service = Availabilities::AvailabilitiesService.new(@no_subscription) + slots = service.machines(Machine.find(1), @no_subscription, { start: 2.days.from_now.beginning_of_day, end: 4.days.from_now.end_of_day }) + + assert_not_empty slots + assert_equal Availability.find(7).slots.count, slots.count + assert_equal Availability.find(7).start_at, slots.first.start_at + assert_equal Availability.find(7).end_at, slots.last.end_at + end + + test 'spaces availabilities' do + service = Availabilities::AvailabilitiesService.new(@no_subscription) + slots = service.spaces(Space.find(1), @no_subscription, { start: 2.days.from_now.beginning_of_day, end: 4.days.from_now.end_of_day }) + + assert_not_empty slots + assert_equal Availability.find(18).slots.count, slots.count + assert_equal Availability.find(18).start_at, slots.first.start_at + assert_equal Availability.find(18).end_at, slots.last.end_at + end + + test 'trainings availabilities' do + service = Availabilities::AvailabilitiesService.new(@no_subscription) + trainings = [Training.find(1), Training.find(2)] + slots = service.trainings(trainings, @no_subscription, { start: DateTime.current.beginning_of_day, end: 2.days.from_now.end_of_day }) + + assert_not_empty slots + if DateTime.current.hour > 10 + assert_equal Availability.find(2).slots.count, slots.count + else + assert_equal Availability.find(1).slots.count + Availability.find(2).slots.count, slots.count + end + end + + test 'events availability' do + service = Availabilities::AvailabilitiesService.new(@no_subscription) + slots = service.events([Event.find(4)], @no_subscription, { start: DateTime.current.beginning_of_day, end: 30.days.from_now.end_of_day }) + + assert_not_empty slots + assert_equal Availability.find(17).slots.count, slots.count + assert_equal Availability.find(17).start_at, slots.first.start_at + assert_equal Availability.find(17).end_at, slots.first.end_at + end +end diff --git a/test/services/subscription_extension_after_reservation_test.rb b/test/services/subscription_extension_after_reservation_test.rb index aa7e45cb6..07059562c 100644 --- a/test/services/subscription_extension_after_reservation_test.rb +++ b/test/services/subscription_extension_after_reservation_test.rb @@ -14,15 +14,18 @@ class SubscriptionExtensionAfterReservationTest < ActiveSupport::TestCase @user.reservations.destroy_all # ensure no reservations + @slot_reservation_machine = SlotsReservation.new({ slot_id: @machine.availabilities.first.slots.first.id }) + @slot_reservation_training = SlotsReservation.new({ slot_id: @training.availabilities.first.slots.first.id }) + @reservation_machine = Reservation.new( statistic_profile: @user.statistic_profile, reservable: @machine, - slots_reservations: [{ slot_id: @machine.availabilities.first.slots.first.id }] + slots_reservations: [@slot_reservation_machine] ) @reservation_training = Reservation.new( statistic_profile: @user.statistic_profile, reservable: @training, - slots_reservations: [{ slot_id: @training.availabilities.first.slots.first.id }] + slots_reservations: [@slot_reservation_training] ) @reservation_training.save! end @@ -53,6 +56,6 @@ class SubscriptionExtensionAfterReservationTest < ActiveSupport::TestCase test 'method extend_subscription' do SubscriptionExtensionAfterReservation.new(@reservation_training).extend_subscription - assert_equal @reservation_training.slots.first.start_at + @plan.duration, @user.subscription.expired_at + assert_equal @reservation_training.slots_reservations.first.slot.start_at + @plan.duration, @user.subscription.expired_at end end