mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-29 18:52:22 +01:00
[feature] configuration of max visibility for reservations
This commit is contained in:
parent
eb4f97000d
commit
cf6afb817d
@ -2,10 +2,12 @@
|
||||
|
||||
## next release
|
||||
|
||||
- Ability for admins to configure the maximum visibility for availabilities reservation
|
||||
- Fix a bug: admins cannot see all availabilities for spaces in reservation calendar when a user is selected
|
||||
- Fix a bug: missing translation after payment in english and portuguese
|
||||
- Updated puma for compatibility with openSSL > 1.0
|
||||
- Updated puma for compatibility with openSSL > 1.0
|
||||
- Documented installation on ArchLinux
|
||||
- [TODO DEPLOY] `rake db:seed`
|
||||
|
||||
## v2.5.10 2017 August 16
|
||||
|
||||
|
@ -66,7 +66,7 @@ Application.Controllers.controller "SettingsController", ["$scope", 'Setting', '
|
||||
|
||||
$scope.moveDelay =
|
||||
name: 'booking_move_delay'
|
||||
value: parseInt(settingsPromise.booking_move_delay)
|
||||
value: parseInt(settingsPromise.booking_move_delay, 10)
|
||||
|
||||
$scope.enableCancel =
|
||||
name: 'booking_cancel_enable'
|
||||
@ -74,7 +74,7 @@ Application.Controllers.controller "SettingsController", ["$scope", 'Setting', '
|
||||
|
||||
$scope.cancelDelay =
|
||||
name: 'booking_cancel_delay'
|
||||
value: parseInt(settingsPromise.booking_cancel_delay)
|
||||
value: parseInt(settingsPromise.booking_cancel_delay, 10)
|
||||
|
||||
$scope.enableReminder =
|
||||
name: 'reminder_enable'
|
||||
@ -82,7 +82,15 @@ Application.Controllers.controller "SettingsController", ["$scope", 'Setting', '
|
||||
|
||||
$scope.reminderDelay =
|
||||
name: 'reminder_delay'
|
||||
value: parseInt(settingsPromise.reminder_delay)
|
||||
value: parseInt(settingsPromise.reminder_delay, 10)
|
||||
|
||||
$scope.visibilityYearly =
|
||||
name: 'visibility_yearly'
|
||||
value: parseInt(settingsPromise.visibility_yearly, 10)
|
||||
|
||||
$scope.visibilityOthers =
|
||||
name: 'visibility_others'
|
||||
value: parseInt(settingsPromise.visibility_others, 10)
|
||||
|
||||
|
||||
|
||||
|
@ -1156,7 +1156,9 @@ angular.module('application.router', ['ui.router']).
|
||||
'fablab_name',
|
||||
'name_genre',
|
||||
'reminder_enable',
|
||||
'reminder_delay'
|
||||
'reminder_delay',
|
||||
'visibility_yearly',
|
||||
'visibility_others'
|
||||
]").$promise
|
||||
]
|
||||
cguFile: ['CustomAsset', (CustomAsset) ->
|
||||
|
@ -22,7 +22,34 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<h3 class="m-l" translate>{{ 'settings.ability_for_the_users_to_move_their_reservations' }}</h3>
|
||||
<h3 class="m-l m-t-lg" translate>{{ 'settings.max_visibility' }}</h3>
|
||||
<form class="col-md-4" name="visibilityYearlyForm">
|
||||
<label for="yearlySubscribers" class="control-label m-r" translate>{{ 'settings.visibility_for_yearly_members' }}</label>
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">
|
||||
<i class="fa fa-calendar"></i>
|
||||
</div>
|
||||
<input type="number" class="form-control" id="yearlySubscribers" ng-model="visibilityYearly.value" min="1" required>
|
||||
</div>
|
||||
</div>
|
||||
<button name="button" class="btn btn-warning" ng-click="save(visibilityYearly)" ng-disabled="visibilityYearlyForm.$invalid" translate>{{ 'save' }}</button>
|
||||
</form>
|
||||
<form class="col-md-4 col-md-offset-2" name="visibilityOthersForm">
|
||||
<label for="others" class="control-label m-r" translate>{{ 'settings.visibility_for_other_members' }}</label>
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">
|
||||
<i class="fa fa-calendar"></i>
|
||||
</div>
|
||||
<input type="number" class="form-control" id="others" ng-model="visibilityOthers.value" min="1" required>
|
||||
</div>
|
||||
</div>
|
||||
<button name="button" class="btn btn-warning" ng-click="save(visibilityOthers)" ng-disabled="visibilityOthersForm.$invalid" translate>{{ 'save' }}</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="row">
|
||||
<h3 class="m-l m-t-lg" translate>{{ 'settings.ability_for_the_users_to_move_their_reservations' }}</h3>
|
||||
<div class="form-group m-l">
|
||||
<label for="enableMove" class="control-label m-r" translate>{{ 'settings.reservations_shifting' }}</label>
|
||||
<input bs-switch
|
||||
@ -51,7 +78,7 @@
|
||||
</form>
|
||||
</div>
|
||||
<div class="row">
|
||||
<h3 class="m-l" translate>{{ 'settings.ability_for_the_users_to_cancel_their_reservations' }}</h3>
|
||||
<h3 class="m-l m-t-lg" translate>{{ 'settings.ability_for_the_users_to_cancel_their_reservations' }}</h3>
|
||||
<div class="form-group m-l">
|
||||
<label for="enableCancel" class="control-label m-r" translate>{{ 'settings.reservations_cancelling' }}</label>
|
||||
<input bs-switch
|
||||
|
@ -3,6 +3,7 @@ class API::AvailabilitiesController < API::ApiController
|
||||
|
||||
before_action :authenticate_user!, except: [:public]
|
||||
before_action :set_availability, only: [:show, :update, :destroy, :reservations]
|
||||
before_action :define_max_visibility, only: [:machine, :trainings, :spaces]
|
||||
respond_to :json
|
||||
|
||||
def index
|
||||
@ -126,8 +127,8 @@ class API::AvailabilitiesController < API::ApiController
|
||||
if @user.is_admin?
|
||||
@availabilities = @machine.availabilities.includes(:tags).where("end_at > ? AND available_type = 'machines'", Time.now)
|
||||
else
|
||||
end_at = 1.month.since
|
||||
end_at = 3.months.since if is_subscription_year(@user)
|
||||
end_at = @visi_max_other
|
||||
end_at = @visi_max_year if is_subscription_year(@user)
|
||||
@availabilities = @machine.availabilities.includes(:tags).where("end_at > ? AND end_at < ? AND available_type = 'machines'", Time.now, end_at).where('availability_tags.tag_id' => @user.tag_ids.concat([nil]))
|
||||
end
|
||||
@availabilities.each do |a|
|
||||
@ -169,8 +170,8 @@ class API::AvailabilitiesController < API::ApiController
|
||||
@availabilities = @availabilities.includes(:tags, :slots, trainings: [:machines]).where('availabilities.start_at > ?', Time.now)
|
||||
# 2) an user (he cannot see availabilities further than 1 (or 3) months)
|
||||
else
|
||||
end_at = 1.month.since
|
||||
end_at = 3.months.since if can_show_slot_plus_three_months(@user)
|
||||
end_at = @visi_max_year
|
||||
end_at = @visi_max_year if can_show_slot_plus_three_months(@user)
|
||||
@availabilities = @availabilities.includes(:tags, :slots, :availability_tags, trainings: [:machines]).where('availabilities.start_at > ? AND availabilities.start_at < ?', Time.now, end_at).where('availability_tags.tag_id' => @user.tag_ids.concat([nil]))
|
||||
end
|
||||
|
||||
@ -193,8 +194,8 @@ class API::AvailabilitiesController < API::ApiController
|
||||
if current_user.is_admin?
|
||||
@availabilities = @space.availabilities.includes(:tags).where("end_at > ? AND available_type = 'space'", Time.now)
|
||||
else
|
||||
end_at = 1.month.since
|
||||
end_at = 3.months.since if is_subscription_year(@user)
|
||||
end_at = @visi_max_other
|
||||
end_at = @visi_max_year if is_subscription_year(@user)
|
||||
@availabilities = @space.availabilities.includes(:tags).where("end_at > ? AND end_at < ? AND available_type = 'space'", Time.now, end_at).where('availability_tags.tag_id' => @user.tag_ids.concat([nil]))
|
||||
end
|
||||
@availabilities.each do |a|
|
||||
@ -371,4 +372,9 @@ class API::AvailabilitiesController < API::ApiController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def define_max_visibility
|
||||
@visi_max_year = Setting.find_by(name: 'visibility_yearly').value.to_i.months.since
|
||||
@visi_max_other = Setting.find_by(name: 'visibility_others').value.to_i.months.since
|
||||
end
|
||||
end
|
||||
|
@ -32,7 +32,9 @@ class Setting < ActiveRecord::Base
|
||||
reminder_enable
|
||||
reminder_delay
|
||||
event_explications_alert
|
||||
space_explications_alert )
|
||||
space_explications_alert
|
||||
visibility_yearly
|
||||
visibility_others )
|
||||
}
|
||||
|
||||
after_update :update_stylesheet if :value_changed?
|
||||
|
@ -574,6 +574,9 @@ en:
|
||||
confine_the_booking_agenda: "Confine the booking agenda"
|
||||
opening_time: "Opening time"
|
||||
closing_time: "Closing time"
|
||||
max_visibility: "Maximum visibility (in months)"
|
||||
visibility_for_yearly_members: "For currently running subscriptions, at least 1 year long"
|
||||
visibility_for_other_members: "For all other members"
|
||||
ability_for_the_users_to_move_their_reservations: "Ability for the users to move their reservations"
|
||||
reservations_shifting: "Reservations shifting"
|
||||
prior_period_(hours): "Prior period (hours)"
|
||||
@ -608,6 +611,8 @@ en:
|
||||
reminder_enable: "reservation reminding enabling"
|
||||
reminder_delay: "delay before sending the reminder"
|
||||
default_value_is_24_hours: "If the field is leaved empty: 24 hours."
|
||||
visibility_yearly: "maximum visibility for annual subscribers"
|
||||
visibility_others: "maximum visibility for other members"
|
||||
|
||||
open_api_clients:
|
||||
add_new_client: "Create new API client"
|
||||
|
@ -574,6 +574,9 @@ fr:
|
||||
confine_the_booking_agenda: "Borner l'agenda de réservation"
|
||||
opening_time: "Heure d'ouverture"
|
||||
closing_time: "Heure de fermeture"
|
||||
max_visibility: "Visibilité maximum (en mois)"
|
||||
visibility_for_yearly_members: "Pour les abonnements en cours d'au moins 1 an"
|
||||
visibility_for_other_members: "Pour tous les autres membres"
|
||||
ability_for_the_users_to_move_their_reservations: "Possibilité pour l'utilisateur de déplacer ses réservations"
|
||||
reservations_shifting: "Déplacement des réservations"
|
||||
prior_period_(hours): "Délai préalable (en heures)"
|
||||
@ -608,6 +611,8 @@ fr:
|
||||
reminder_enable: "l'activation du rappel de réservation"
|
||||
reminder_delay: "délai avant envoi de la notification de rappel"
|
||||
default_value_is_24_hours: "Si aucune valeur n'est renseignée : 24 heures."
|
||||
visibility_yearly: "la visibilité maximum pour les abonnées annuels"
|
||||
visibility_others: "la visibilité maximum pour les autres membres"
|
||||
|
||||
open_api_clients:
|
||||
add_new_client: "Créer un compte client"
|
||||
|
@ -574,6 +574,9 @@ pt:
|
||||
confine_the_booking_agenda: "Confine a agenda de reserva"
|
||||
opening_time: "Horário de abertura"
|
||||
closing_time: "Horário de fechamento"
|
||||
max_visibility: "Visibilidade máxima (em meses)"
|
||||
visibility_for_yearly_members: "Para inscrições atuais de pelo menos 1 ano"
|
||||
visibility_for_other_members: "Para todos os outros membros"
|
||||
ability_for_the_users_to_move_their_reservations: "Habilidade para os usuários mover suas reservas"
|
||||
reservations_shifting: "Mudança de reservas"
|
||||
prior_period_(hours): "Período anterior (horas)"
|
||||
@ -608,6 +611,8 @@ pt:
|
||||
reminder_enable: "Recordar reserva ativo"
|
||||
reminder_delay: "Atraso antes de enviar o lembrete"
|
||||
default_value_is_24_hours: "Se o campo estiver vazio: 24 horas."
|
||||
visibility_yearly: "visibilidade máxima para assinantes anuais"
|
||||
visibility_others: "visibilidade máxima para outros membros"
|
||||
|
||||
open_api_clients:
|
||||
add_new_client: "Criar novo cliente de API"
|
||||
|
180
db/schema.rb
180
db/schema.rb
@ -15,8 +15,8 @@ ActiveRecord::Schema.define(version: 20170227114634) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
enable_extension "unaccent"
|
||||
enable_extension "pg_trgm"
|
||||
enable_extension "unaccent"
|
||||
|
||||
create_table "abuses", force: :cascade do |t|
|
||||
t.integer "signaled_id"
|
||||
@ -32,14 +32,14 @@ ActiveRecord::Schema.define(version: 20170227114634) do
|
||||
add_index "abuses", ["signaled_type", "signaled_id"], name: "index_abuses_on_signaled_type_and_signaled_id", using: :btree
|
||||
|
||||
create_table "addresses", force: :cascade do |t|
|
||||
t.string "address"
|
||||
t.string "street_number"
|
||||
t.string "route"
|
||||
t.string "locality"
|
||||
t.string "country"
|
||||
t.string "postal_code"
|
||||
t.string "address", limit: 255
|
||||
t.string "street_number", limit: 255
|
||||
t.string "route", limit: 255
|
||||
t.string "locality", limit: 255
|
||||
t.string "country", limit: 255
|
||||
t.string "postal_code", limit: 255
|
||||
t.integer "placeable_id"
|
||||
t.string "placeable_type"
|
||||
t.string "placeable_type", limit: 255
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
@ -55,9 +55,9 @@ ActiveRecord::Schema.define(version: 20170227114634) do
|
||||
|
||||
create_table "assets", force: :cascade do |t|
|
||||
t.integer "viewable_id"
|
||||
t.string "viewable_type"
|
||||
t.string "attachment"
|
||||
t.string "type"
|
||||
t.string "viewable_type", limit: 255
|
||||
t.string "attachment", limit: 255
|
||||
t.string "type", limit: 255
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
@ -74,11 +74,11 @@ ActiveRecord::Schema.define(version: 20170227114634) do
|
||||
create_table "availabilities", force: :cascade do |t|
|
||||
t.datetime "start_at"
|
||||
t.datetime "end_at"
|
||||
t.string "available_type"
|
||||
t.string "available_type", limit: 255
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "nb_total_places"
|
||||
t.boolean "destroying", default: false
|
||||
t.boolean "destroying", default: false
|
||||
end
|
||||
|
||||
create_table "availability_tags", force: :cascade do |t|
|
||||
@ -92,7 +92,7 @@ ActiveRecord::Schema.define(version: 20170227114634) do
|
||||
add_index "availability_tags", ["tag_id"], name: "index_availability_tags_on_tag_id", using: :btree
|
||||
|
||||
create_table "categories", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.string "name", limit: 255
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "slug"
|
||||
@ -101,7 +101,7 @@ ActiveRecord::Schema.define(version: 20170227114634) do
|
||||
add_index "categories", ["slug"], name: "index_categories_on_slug", unique: true, using: :btree
|
||||
|
||||
create_table "components", force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
t.string "name", limit: 255, null: false
|
||||
end
|
||||
|
||||
create_table "coupons", force: :cascade do |t|
|
||||
@ -119,7 +119,7 @@ ActiveRecord::Schema.define(version: 20170227114634) do
|
||||
|
||||
create_table "credits", force: :cascade do |t|
|
||||
t.integer "creditable_id"
|
||||
t.string "creditable_type"
|
||||
t.string "creditable_type", limit: 255
|
||||
t.integer "plan_id"
|
||||
t.integer "hours"
|
||||
t.datetime "created_at"
|
||||
@ -160,7 +160,7 @@ ActiveRecord::Schema.define(version: 20170227114634) do
|
||||
add_index "event_themes", ["slug"], name: "index_event_themes_on_slug", unique: true, using: :btree
|
||||
|
||||
create_table "events", force: :cascade do |t|
|
||||
t.string "title"
|
||||
t.string "title", limit: 255
|
||||
t.text "description"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
@ -198,10 +198,10 @@ ActiveRecord::Schema.define(version: 20170227114634) do
|
||||
add_index "exports", ["user_id"], name: "index_exports_on_user_id", using: :btree
|
||||
|
||||
create_table "friendly_id_slugs", force: :cascade do |t|
|
||||
t.string "slug", null: false
|
||||
t.integer "sluggable_id", null: false
|
||||
t.string "slug", limit: 255, null: false
|
||||
t.integer "sluggable_id", null: false
|
||||
t.string "sluggable_type", limit: 50
|
||||
t.string "scope"
|
||||
t.string "scope", limit: 255
|
||||
t.datetime "created_at"
|
||||
end
|
||||
|
||||
@ -211,17 +211,17 @@ ActiveRecord::Schema.define(version: 20170227114634) do
|
||||
add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree
|
||||
|
||||
create_table "groups", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.string "name", limit: 255
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "slug"
|
||||
t.string "slug", limit: 255
|
||||
end
|
||||
|
||||
add_index "groups", ["slug"], name: "index_groups_on_slug", unique: true, using: :btree
|
||||
|
||||
create_table "invoice_items", force: :cascade do |t|
|
||||
t.integer "invoice_id"
|
||||
t.string "stp_invoice_item_id"
|
||||
t.string "stp_invoice_item_id", limit: 255
|
||||
t.integer "amount"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
@ -234,17 +234,17 @@ ActiveRecord::Schema.define(version: 20170227114634) do
|
||||
|
||||
create_table "invoices", force: :cascade do |t|
|
||||
t.integer "invoiced_id"
|
||||
t.string "invoiced_type"
|
||||
t.string "stp_invoice_id"
|
||||
t.string "invoiced_type", limit: 255
|
||||
t.string "stp_invoice_id", limit: 255
|
||||
t.integer "total"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "user_id"
|
||||
t.string "reference"
|
||||
t.string "avoir_mode"
|
||||
t.string "reference", limit: 255
|
||||
t.string "avoir_mode", limit: 255
|
||||
t.datetime "avoir_date"
|
||||
t.integer "invoice_id"
|
||||
t.string "type"
|
||||
t.string "type", limit: 255
|
||||
t.boolean "subscription_to_expire"
|
||||
t.text "description"
|
||||
t.integer "wallet_amount"
|
||||
@ -258,17 +258,17 @@ ActiveRecord::Schema.define(version: 20170227114634) do
|
||||
add_index "invoices", ["wallet_transaction_id"], name: "index_invoices_on_wallet_transaction_id", using: :btree
|
||||
|
||||
create_table "licences", force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
t.string "name", limit: 255, null: false
|
||||
t.text "description"
|
||||
end
|
||||
|
||||
create_table "machines", force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
t.string "name", limit: 255, null: false
|
||||
t.text "description"
|
||||
t.text "spec"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "slug"
|
||||
t.string "slug", limit: 255
|
||||
end
|
||||
|
||||
add_index "machines", ["slug"], name: "index_machines_on_slug", unique: true, using: :btree
|
||||
@ -284,14 +284,14 @@ ActiveRecord::Schema.define(version: 20170227114634) do
|
||||
create_table "notifications", force: :cascade do |t|
|
||||
t.integer "receiver_id"
|
||||
t.integer "attached_object_id"
|
||||
t.string "attached_object_type"
|
||||
t.string "attached_object_type", limit: 255
|
||||
t.integer "notification_type_id"
|
||||
t.boolean "is_read", default: false
|
||||
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.boolean "is_send", default: false
|
||||
t.jsonb "meta_data", default: {}
|
||||
end
|
||||
|
||||
add_index "notifications", ["notification_type_id"], name: "index_notifications_on_notification_type_id", using: :btree
|
||||
@ -360,20 +360,20 @@ ActiveRecord::Schema.define(version: 20170227114634) do
|
||||
add_index "organizations", ["profile_id"], name: "index_organizations_on_profile_id", using: :btree
|
||||
|
||||
create_table "plans", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.string "name", limit: 255
|
||||
t.integer "amount"
|
||||
t.string "interval"
|
||||
t.string "interval", limit: 255
|
||||
t.integer "group_id"
|
||||
t.string "stp_plan_id"
|
||||
t.string "stp_plan_id", limit: 255
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "training_credit_nb", default: 0
|
||||
t.boolean "is_rolling", default: true
|
||||
t.integer "training_credit_nb", default: 0
|
||||
t.boolean "is_rolling", default: true
|
||||
t.text "description"
|
||||
t.string "type"
|
||||
t.string "base_name"
|
||||
t.integer "ui_weight", default: 0
|
||||
t.integer "interval_count", default: 1
|
||||
t.integer "ui_weight", default: 0
|
||||
t.integer "interval_count", default: 1
|
||||
t.string "slug"
|
||||
end
|
||||
|
||||
@ -402,11 +402,11 @@ ActiveRecord::Schema.define(version: 20170227114634) do
|
||||
|
||||
create_table "profiles", force: :cascade do |t|
|
||||
t.integer "user_id"
|
||||
t.string "first_name"
|
||||
t.string "last_name"
|
||||
t.string "first_name", limit: 255
|
||||
t.string "last_name", limit: 255
|
||||
t.boolean "gender"
|
||||
t.date "birthday"
|
||||
t.string "phone"
|
||||
t.string "phone", limit: 255
|
||||
t.text "interest"
|
||||
t.text "software_mastered"
|
||||
t.datetime "created_at"
|
||||
@ -436,7 +436,7 @@ ActiveRecord::Schema.define(version: 20170227114634) do
|
||||
t.integer "project_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "title"
|
||||
t.string "title", limit: 255
|
||||
t.integer "step_nb"
|
||||
end
|
||||
|
||||
@ -447,27 +447,27 @@ ActiveRecord::Schema.define(version: 20170227114634) do
|
||||
t.integer "user_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.boolean "is_valid", default: false
|
||||
t.string "valid_token"
|
||||
t.boolean "is_valid", default: false
|
||||
t.string "valid_token", limit: 255
|
||||
end
|
||||
|
||||
add_index "project_users", ["project_id"], name: "index_project_users_on_project_id", using: :btree
|
||||
add_index "project_users", ["user_id"], name: "index_project_users_on_user_id", using: :btree
|
||||
|
||||
create_table "projects", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.string "name", limit: 255
|
||||
t.text "description"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "author_id"
|
||||
t.text "tags"
|
||||
t.integer "licence_id"
|
||||
t.string "state"
|
||||
t.string "slug"
|
||||
t.string "state", limit: 255
|
||||
t.string "slug", limit: 255
|
||||
t.datetime "published_at"
|
||||
end
|
||||
|
||||
add_index "projects", ["slug"], name: "index_projects_on_slug", unique: true, using: :btree
|
||||
add_index "projects", ["slug"], name: "index_projects_on_slug", using: :btree
|
||||
|
||||
create_table "projects_components", force: :cascade do |t|
|
||||
t.integer "project_id"
|
||||
@ -507,19 +507,19 @@ ActiveRecord::Schema.define(version: 20170227114634) do
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "reservable_id"
|
||||
t.string "reservable_type"
|
||||
t.string "stp_invoice_id"
|
||||
t.string "reservable_type", limit: 255
|
||||
t.string "stp_invoice_id", limit: 255
|
||||
t.integer "nb_reserve_places"
|
||||
end
|
||||
|
||||
add_index "reservations", ["reservable_type", "reservable_id"], name: "index_reservations_on_reservable_type_and_reservable_id", using: :btree
|
||||
add_index "reservations", ["reservable_id", "reservable_type"], name: "index_reservations_on_reservable_id_and_reservable_type", using: :btree
|
||||
add_index "reservations", ["stp_invoice_id"], name: "index_reservations_on_stp_invoice_id", using: :btree
|
||||
add_index "reservations", ["user_id"], name: "index_reservations_on_user_id", using: :btree
|
||||
|
||||
create_table "roles", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.string "name", limit: 255
|
||||
t.integer "resource_id"
|
||||
t.string "resource_type"
|
||||
t.string "resource_type", limit: 255
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
@ -593,18 +593,18 @@ ActiveRecord::Schema.define(version: 20170227114634) do
|
||||
|
||||
create_table "statistic_fields", force: :cascade do |t|
|
||||
t.integer "statistic_index_id"
|
||||
t.string "key"
|
||||
t.string "label"
|
||||
t.string "key", limit: 255
|
||||
t.string "label", limit: 255
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "data_type"
|
||||
t.string "data_type", limit: 255
|
||||
end
|
||||
|
||||
add_index "statistic_fields", ["statistic_index_id"], name: "index_statistic_fields_on_statistic_index_id", using: :btree
|
||||
|
||||
create_table "statistic_graphs", force: :cascade do |t|
|
||||
t.integer "statistic_index_id"
|
||||
t.string "chart_type"
|
||||
t.string "chart_type", limit: 255
|
||||
t.integer "limit"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
@ -613,17 +613,17 @@ ActiveRecord::Schema.define(version: 20170227114634) do
|
||||
add_index "statistic_graphs", ["statistic_index_id"], name: "index_statistic_graphs_on_statistic_index_id", using: :btree
|
||||
|
||||
create_table "statistic_indices", force: :cascade do |t|
|
||||
t.string "es_type_key"
|
||||
t.string "label"
|
||||
t.string "es_type_key", limit: 255
|
||||
t.string "label", limit: 255
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.boolean "table", default: true
|
||||
t.boolean "ca", default: true
|
||||
t.boolean "table", default: true
|
||||
t.boolean "ca", default: true
|
||||
end
|
||||
|
||||
create_table "statistic_sub_types", force: :cascade do |t|
|
||||
t.string "key"
|
||||
t.string "label"
|
||||
t.string "key", limit: 255
|
||||
t.string "label", limit: 255
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
@ -640,8 +640,8 @@ ActiveRecord::Schema.define(version: 20170227114634) do
|
||||
|
||||
create_table "statistic_types", force: :cascade do |t|
|
||||
t.integer "statistic_index_id"
|
||||
t.string "key"
|
||||
t.string "label"
|
||||
t.string "key", limit: 255
|
||||
t.string "label", limit: 255
|
||||
t.boolean "graph"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
@ -659,7 +659,7 @@ ActiveRecord::Schema.define(version: 20170227114634) do
|
||||
create_table "subscriptions", force: :cascade do |t|
|
||||
t.integer "plan_id"
|
||||
t.integer "user_id"
|
||||
t.string "stp_subscription_id"
|
||||
t.string "stp_subscription_id", limit: 255
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "expired_at"
|
||||
@ -678,7 +678,7 @@ ActiveRecord::Schema.define(version: 20170227114634) do
|
||||
add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree
|
||||
|
||||
create_table "themes", force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
t.string "name", limit: 255, null: false
|
||||
end
|
||||
|
||||
create_table "tickets", force: :cascade do |t|
|
||||
@ -693,13 +693,13 @@ ActiveRecord::Schema.define(version: 20170227114634) do
|
||||
add_index "tickets", ["reservation_id"], name: "index_tickets_on_reservation_id", using: :btree
|
||||
|
||||
create_table "trainings", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.string "name", limit: 255
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "nb_total_places"
|
||||
t.string "slug"
|
||||
t.string "slug", limit: 255
|
||||
t.text "description"
|
||||
t.boolean "public_page", default: true
|
||||
t.boolean "public_page", default: true
|
||||
end
|
||||
|
||||
add_index "trainings", ["slug"], name: "index_trainings_on_slug", unique: true, using: :btree
|
||||
@ -754,32 +754,32 @@ ActiveRecord::Schema.define(version: 20170227114634) do
|
||||
add_index "user_trainings", ["user_id"], name: "index_user_trainings_on_user_id", using: :btree
|
||||
|
||||
create_table "users", force: :cascade do |t|
|
||||
t.string "email", default: "", null: false
|
||||
t.string "encrypted_password", default: "", null: false
|
||||
t.string "reset_password_token"
|
||||
t.string "email", limit: 255, default: "", null: false
|
||||
t.string "encrypted_password", limit: 255, default: "", null: false
|
||||
t.string "reset_password_token", limit: 255
|
||||
t.datetime "reset_password_sent_at"
|
||||
t.datetime "remember_created_at"
|
||||
t.integer "sign_in_count", default: 0, null: false
|
||||
t.integer "sign_in_count", default: 0, null: false
|
||||
t.datetime "current_sign_in_at"
|
||||
t.datetime "last_sign_in_at"
|
||||
t.string "current_sign_in_ip"
|
||||
t.string "last_sign_in_ip"
|
||||
t.string "confirmation_token"
|
||||
t.string "current_sign_in_ip", limit: 255
|
||||
t.string "last_sign_in_ip", limit: 255
|
||||
t.string "confirmation_token", limit: 255
|
||||
t.datetime "confirmed_at"
|
||||
t.datetime "confirmation_sent_at"
|
||||
t.string "unconfirmed_email"
|
||||
t.integer "failed_attempts", default: 0, null: false
|
||||
t.string "unlock_token"
|
||||
t.string "unconfirmed_email", limit: 255
|
||||
t.integer "failed_attempts", default: 0, null: false
|
||||
t.string "unlock_token", limit: 255
|
||||
t.datetime "locked_at"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.boolean "is_allow_contact", default: true
|
||||
t.boolean "is_allow_contact", default: true
|
||||
t.integer "group_id"
|
||||
t.string "stp_customer_id"
|
||||
t.string "username"
|
||||
t.string "slug"
|
||||
t.boolean "is_active", default: true
|
||||
t.boolean "invoicing_disabled", default: false
|
||||
t.string "stp_customer_id", limit: 255
|
||||
t.string "username", limit: 255
|
||||
t.string "slug", limit: 255
|
||||
t.boolean "is_active", default: true
|
||||
t.boolean "invoicing_disabled", default: false
|
||||
t.string "provider"
|
||||
t.string "uid"
|
||||
t.string "auth_token"
|
||||
|
12
db/seeds.rb
12
db/seeds.rb
@ -397,6 +397,18 @@ unless Setting.find_by(name: 'reminder_delay').try(:value)
|
||||
setting.save
|
||||
end
|
||||
|
||||
unless Setting.find_by(name: 'visibility_yearly').try(:value)
|
||||
setting = Setting.find_or_initialize_by(name: 'visibility_yearly')
|
||||
setting.value = '3'
|
||||
setting.save
|
||||
end
|
||||
|
||||
unless Setting.find_by(name: 'visibility_others').try(:value)
|
||||
setting = Setting.find_or_initialize_by(name: 'visibility_others')
|
||||
setting.value = '1'
|
||||
setting.save
|
||||
end
|
||||
|
||||
if StatisticCustomAggregation.count == 0
|
||||
# available reservations hours for machines
|
||||
machine_hours = StatisticType.find_by(key: 'hour', statistic_index_id: 2)
|
||||
|
Loading…
x
Reference in New Issue
Block a user