diff --git a/app/models/age_range.rb b/app/models/age_range.rb index 31e8738ff..64df20ed6 100644 --- a/app/models/age_range.rb +++ b/app/models/age_range.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# AgeRange is an optional filter used to categorize Events +# AgeRange class AgeRange < ApplicationRecord extend FriendlyId friendly_id :name, use: :slugged diff --git a/app/models/statistic_custom_aggregation.rb b/app/models/statistic_custom_aggregation.rb index 09bc623de..4c6f45087 100644 --- a/app/models/statistic_custom_aggregation.rb +++ b/app/models/statistic_custom_aggregation.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # StatisticCustomAggregation is an ElasticSearch aggregation that will run when the end-user is browsing the statistics -# page for the related statisticType. +# page for the related StatisticType. # See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations.html class StatisticCustomAggregation < ApplicationRecord belongs_to :statistic_type diff --git a/app/models/tag.rb b/app/models/tag.rb index 1fc6a82fe..89a6f6957 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -1,3 +1,6 @@ +# frozen_string_literal: true + +# Tag is a way to restrict an Availability for reservation to users with the same Tag. class Tag < ApplicationRecord has_many :user_tags, dependent: :destroy has_many :users, through: :user_tags diff --git a/app/models/theme.rb b/app/models/theme.rb index ca70f8568..c4813a1a4 100644 --- a/app/models/theme.rb +++ b/app/models/theme.rb @@ -1,3 +1,6 @@ +# frozen_string_literal: true + +# Theme is an optional filter used to categorize Projects class Theme < ApplicationRecord has_and_belongs_to_many :projects, join_table: :projects_themes validates :name, presence: true, length: { maximum: 80 } diff --git a/app/models/ticket.rb b/app/models/ticket.rb index 5351e9804..2da7fa2a0 100644 --- a/app/models/ticket.rb +++ b/app/models/ticket.rb @@ -1,3 +1,7 @@ +# frozen_string_literal: true + +# Ticket is an reservation of a member for an Event, with a specific PriceCategory +# For example, Member John Smith smith has book 2 places on Event "Arduino initiation" at price "reduces fare" class Ticket < ApplicationRecord belongs_to :reservation belongs_to :event_price_category diff --git a/app/models/training.rb b/app/models/training.rb index 8bf724d4f..abb7a2c95 100644 --- a/app/models/training.rb +++ b/app/models/training.rb @@ -1,3 +1,8 @@ +# frozen_string_literal: true + +# Training is a course for members to acquire knowledge on a specific matter. +# Trainings are designed to be scheduled periodically through Availabilities. +# A Training can be a prerequisite before members can book a Machine. class Training < ApplicationRecord extend FriendlyId friendly_id :name, use: :slugged diff --git a/app/models/training_image.rb b/app/models/training_image.rb index f8b5909e0..f06397812 100644 --- a/app/models/training_image.rb +++ b/app/models/training_image.rb @@ -1,4 +1,6 @@ +# frozen_string_literal: true +# TrainingImage is the main picture for a Training class TrainingImage < Asset mount_uploader :attachment, TrainingImageUploader end \ No newline at end of file diff --git a/app/models/trainings_availability.rb b/app/models/trainings_availability.rb index fd648465f..3ccab5bd9 100644 --- a/app/models/trainings_availability.rb +++ b/app/models/trainings_availability.rb @@ -1,3 +1,7 @@ +# frozen_string_literal: true + +# TrainingsAvailability is the relation table between a Training and an Availability. +# Is is used to schedule a training session, for members to be able to book it. class TrainingsAvailability < ApplicationRecord belongs_to :training belongs_to :availability diff --git a/app/models/trainings_pricing.rb b/app/models/trainings_pricing.rb index 14e1146aa..689f8946e 100644 --- a/app/models/trainings_pricing.rb +++ b/app/models/trainings_pricing.rb @@ -1,3 +1,6 @@ +# frozen_string_literal: true + +# TrainingsPricing configures the price of a Training session, per Group class TrainingsPricing < ApplicationRecord belongs_to :training belongs_to :group diff --git a/app/models/user.rb b/app/models/user.rb index 9be7b4efb..175ab6fc3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # User is a physical or moral person with its authentication parameters -# It is linked to the Profile model with hold informations about this person (like address, name, etc.) +# It is linked to the Profile model with hold information about this person (like address, name, etc.) class User < ApplicationRecord include NotifyWith::NotificationReceiver include NotifyWith::NotificationAttachedObject diff --git a/app/models/user_avatar.rb b/app/models/user_avatar.rb index 0e172a01c..15e878841 100644 --- a/app/models/user_avatar.rb +++ b/app/models/user_avatar.rb @@ -1,3 +1,6 @@ +# frozen_string_literal: true + +# UserAvatar is the profile picture for an User class UserAvatar < Asset include ImageValidatorConcern mount_uploader :attachment, ProfilImageUploader diff --git a/app/models/user_tag.rb b/app/models/user_tag.rb index cc2ef37c8..2740753ec 100644 --- a/app/models/user_tag.rb +++ b/app/models/user_tag.rb @@ -1,3 +1,7 @@ +# frozen_string_literal: true + +# UserTag is the relation table between a Tag and an User. +# Users with Tags, can book Availabilities associated with the same Tags. class UserTag < ApplicationRecord belongs_to :user belongs_to :tag diff --git a/app/models/users_credit.rb b/app/models/users_credit.rb index f1b804dbb..17a6019b9 100644 --- a/app/models/users_credit.rb +++ b/app/models/users_credit.rb @@ -1,7 +1,11 @@ +# frozen_string_literal: true + +# UserCredit is the relation table between a Credit and an User. +# It saves the consumed credits only class UsersCredit < ApplicationRecord belongs_to :user belongs_to :credit - belongs_to :training_credit, ->{ where('credits.creditable_type = ?', 'Training') }, foreign_key: 'credit_id', class_name: 'Credit' - belongs_to :machine_credit, ->{ where('credits.creditable_type = ?', 'Machine') }, foreign_key: 'credit_id', class_name: 'Credit' + belongs_to :training_credit, -> { where('credits.creditable_type = ?', 'Training') }, foreign_key: 'credit_id', class_name: 'Credit' + belongs_to :machine_credit, -> { where('credits.creditable_type = ?', 'Machine') }, foreign_key: 'credit_id', class_name: 'Credit' end