1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-30 19:52:20 +01:00

(bug) fix slots creation

This commit is contained in:
Sylvain 2022-07-11 12:23:04 +02:00
parent b2fd2e1b48
commit 783e86d9cc
2 changed files with 12 additions and 12 deletions

View File

@ -27,10 +27,10 @@ class Availabilities::CreateAvailabilitiesService
plan_ids: availability.plan_ids
).save!
((o.end_at - o.start_at) / slot_duration.minutes).to_i.times do |i|
(o[:end_at] - o[:start_at] / slot_duration.minutes).to_i.times do |i|
Slot.new(
start_at: o.start_at + (i * slot_duration).minutes,
end_at: o.start_at + (i * slot_duration).minutes + slot_duration.minutes,
start_at: o[:start_at] + (i * slot_duration).minutes,
end_at: o[:start_at] + (i * slot_duration).minutes + slot_duration.minutes,
availability_id: o.id
).save!
end

View File

@ -19,8 +19,8 @@ ActiveRecord::Schema.define(version: 2022_07_05_125232) do
enable_extension "unaccent"
create_table "abuses", id: :serial, force: :cascade do |t|
t.integer "signaled_id"
t.string "signaled_type"
t.integer "signaled_id"
t.string "first_name"
t.string "last_name"
t.string "email"
@ -49,8 +49,8 @@ ActiveRecord::Schema.define(version: 2022_07_05_125232) do
t.string "locality"
t.string "country"
t.string "postal_code"
t.integer "placeable_id"
t.string "placeable_type"
t.integer "placeable_id"
t.datetime "created_at"
t.datetime "updated_at"
end
@ -64,8 +64,8 @@ ActiveRecord::Schema.define(version: 2022_07_05_125232) do
end
create_table "assets", id: :serial, force: :cascade do |t|
t.integer "viewable_id"
t.string "viewable_type"
t.integer "viewable_id"
t.string "attachment"
t.string "type"
t.datetime "created_at"
@ -146,8 +146,8 @@ ActiveRecord::Schema.define(version: 2022_07_05_125232) do
end
create_table "credits", id: :serial, force: :cascade do |t|
t.integer "creditable_id"
t.string "creditable_type"
t.integer "creditable_id"
t.integer "plan_id"
t.integer "hours"
t.datetime "created_at"
@ -369,15 +369,15 @@ ActiveRecord::Schema.define(version: 2022_07_05_125232) do
create_table "notifications", id: :serial, force: :cascade do |t|
t.integer "receiver_id"
t.integer "attached_object_id"
t.string "attached_object_type"
t.integer "attached_object_id"
t.integer "notification_type_id"
t.boolean "is_read", default: false
t.datetime "created_at"
t.datetime "updated_at"
t.string "receiver_type"
t.boolean "is_send", default: false
t.jsonb "meta_data", default: {}
t.jsonb "meta_data", default: "{}"
t.index ["notification_type_id"], name: "index_notifications_on_notification_type_id"
t.index ["receiver_id"], name: "index_notifications_on_receiver_id"
end
@ -570,8 +570,8 @@ ActiveRecord::Schema.define(version: 2022_07_05_125232) do
create_table "prices", id: :serial, force: :cascade do |t|
t.integer "group_id"
t.integer "plan_id"
t.integer "priceable_id"
t.string "priceable_type"
t.integer "priceable_id"
t.integer "amount"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
@ -729,8 +729,8 @@ ActiveRecord::Schema.define(version: 2022_07_05_125232) do
t.text "message"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "reservable_id"
t.string "reservable_type"
t.integer "reservable_id"
t.integer "nb_reserve_places"
t.integer "statistic_profile_id"
t.index ["reservable_type", "reservable_id"], name: "index_reservations_on_reservable_type_and_reservable_id"
@ -739,8 +739,8 @@ ActiveRecord::Schema.define(version: 2022_07_05_125232) do
create_table "roles", id: :serial, force: :cascade do |t|
t.string "name"
t.integer "resource_id"
t.string "resource_type"
t.integer "resource_id"
t.datetime "created_at"
t.datetime "updated_at"
t.index ["name", "resource_type", "resource_id"], name: "index_roles_on_name_and_resource_type_and_resource_id"