Configure license and automated copyright notices #74

Merged
bustikiller merged 2 commits from license into main 2024-10-27 22:14:47 +00:00
80 changed files with 160 additions and 0 deletions
Showing only changes of commit b7cabc1661 - Show all commits

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
module ApplicationCable module ApplicationCable
class Channel < ActionCable::Channel::Base class Channel < ActionCable::Channel::Base
end end

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
module ApplicationCable module ApplicationCable
class Connection < ActionCable::Connection::Base class Connection < ActionCable::Connection::Base
end end

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
class ApplicationController < ActionController::Base class ApplicationController < ActionController::Base
after_action :set_csrf_cookie after_action :set_csrf_cookie

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
class ExpensesController < ApplicationController class ExpensesController < ApplicationController
before_action :set_expense, only: %i[ show edit update destroy ] before_action :set_expense, only: %i[ show edit update destroy ]

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
class GroupsController < ApplicationController class GroupsController < ApplicationController
def index def index
roots = Group.where(parent_id: nil) roots = Group.where(parent_id: nil)

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
require 'csv' require 'csv'
class GuestsController < ApplicationController class GuestsController < ApplicationController

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
class TablesArrangementsController < ApplicationController class TablesArrangementsController < ApplicationController
def index def index
@tables_arrangements = TablesArrangement.all.order(discomfort: :asc).limit(10) @tables_arrangements = TablesArrangement.all.order(discomfort: :asc).limit(10)

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
module TreeNodeExtension module TreeNodeExtension
def distance_to_common_ancestor(another_node) def distance_to_common_ancestor(another_node)
return 0 if self == another_node return 0 if self == another_node

View File

@ -1,2 +1,4 @@
# Copyright (C) 2024 Manuel Bustillo
module ApplicationHelper module ApplicationHelper
end end

View File

@ -1,2 +1,4 @@
# Copyright (C) 2024 Manuel Bustillo
module ExpensesHelper module ExpensesHelper
end end

View File

@ -1,2 +1,4 @@
# Copyright (C) 2024 Manuel Bustillo
module GroupsHelper module GroupsHelper
end end

View File

@ -1,2 +1,4 @@
# Copyright (C) 2024 Manuel Bustillo
module GuestsHelper module GuestsHelper
end end

View File

@ -1,2 +1,4 @@
# Copyright (C) 2024 Manuel Bustillo
module TablesArrangementsHelper module TablesArrangementsHelper
end end

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
class ApplicationJob < ActiveJob::Base class ApplicationJob < ActiveJob::Base
# Automatically retry jobs that encountered a deadlock # Automatically retry jobs that encountered a deadlock
# retry_on ActiveRecord::Deadlocked # retry_on ActiveRecord::Deadlocked

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
class ApplicationMailer < ActionMailer::Base class ApplicationMailer < ActionMailer::Base
default from: "from@example.com" default from: "from@example.com"
layout "mailer" layout "mailer"

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
class ApplicationRecord < ActiveRecord::Base class ApplicationRecord < ActiveRecord::Base
primary_abstract_class primary_abstract_class
end end

View File

@ -1,2 +1,4 @@
# Copyright (C) 2024 Manuel Bustillo
class Expense < ApplicationRecord class Expense < ApplicationRecord
end end

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
class Group < ApplicationRecord class Group < ApplicationRecord
validates :name, uniqueness: true validates :name, uniqueness: true
validates :name, :order, presence: true validates :name, :order, presence: true

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
class Guest < ApplicationRecord class Guest < ApplicationRecord
acts_as_taggable_on :affinity_groups, :unbreakable_bonds acts_as_taggable_on :affinity_groups, :unbreakable_bonds
belongs_to :group belongs_to :group

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
class Seat < ApplicationRecord class Seat < ApplicationRecord
belongs_to :guest belongs_to :guest
belongs_to :table_arrangement belongs_to :table_arrangement

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
class TablesArrangement < ApplicationRecord class TablesArrangement < ApplicationRecord
has_many :seats has_many :seats
end end

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
class SerializableGroup < JSONAPI::Serializable::Resource class SerializableGroup < JSONAPI::Serializable::Resource
type 'group' type 'group'

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
class SerializableGuest < JSONAPI::Serializable::Resource class SerializableGuest < JSONAPI::Serializable::Resource
type 'guest' type 'guest'

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
class AffinityGroupsHierarchy < Array class AffinityGroupsHierarchy < Array
include Singleton include Singleton

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
module Tables module Tables
class DiscomfortCalculator class DiscomfortCalculator
private attr_reader :table private attr_reader :table

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
require_relative '../../extensions/tree_node_extension' require_relative '../../extensions/tree_node_extension'
module Tables module Tables

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
module Tables module Tables
class Swap class Swap
private attr_reader :initial_solution private attr_reader :initial_solution

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
module Tables module Tables
class Table < Array class Table < Array
attr_accessor :discomfort attr_accessor :discomfort

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
module VNS module VNS
class Engine class Engine
def target_function(&function) def target_function(&function)

View File

@ -1,3 +1,5 @@
<%# Copyright (C) 2024 Manuel Bustillo %>
<div id="<%= dom_id expense %>"> <div id="<%= dom_id expense %>">
<p> <p>
<strong>Name:</strong> <strong>Name:</strong>

View File

@ -1,3 +1,5 @@
<%# Copyright (C) 2024 Manuel Bustillo %>
<%= form_with(model: expense) do |form| %> <%= form_with(model: expense) do |form| %>
<% if expense.errors.any? %> <% if expense.errors.any? %>
<div style="color: red"> <div style="color: red">

View File

@ -1,3 +1,5 @@
<%# Copyright (C) 2024 Manuel Bustillo %>
<h1>Editing expense</h1> <h1>Editing expense</h1>
<%= render "form", expense: @expense %> <%= render "form", expense: @expense %>

View File

@ -1,3 +1,5 @@
<%# Copyright (C) 2024 Manuel Bustillo %>
<p style="color: green"><%= notice %></p> <p style="color: green"><%= notice %></p>
<h1>Expenses</h1> <h1>Expenses</h1>

View File

@ -1,3 +1,5 @@
<%# Copyright (C) 2024 Manuel Bustillo %>
<h1>New expense</h1> <h1>New expense</h1>
<%= render "form", expense: @expense %> <%= render "form", expense: @expense %>

View File

@ -1,3 +1,5 @@
<%# Copyright (C) 2024 Manuel Bustillo %>
<p style="color: green"><%= notice %></p> <p style="color: green"><%= notice %></p>
<%= render @expense %> <%= render @expense %>

View File

@ -1,3 +1,5 @@
<%# Copyright (C) 2024 Manuel Bustillo %>
<%= form_with(model: guest) do |form| %> <%= form_with(model: guest) do |form| %>
<% if guest.errors.any? %> <% if guest.errors.any? %>
<div style="color: red"> <div style="color: red">

View File

@ -1,3 +1,5 @@
<%# Copyright (C) 2024 Manuel Bustillo %>
<div id="<%= dom_id guest %>"> <div id="<%= dom_id guest %>">
<p> <p>
<strong>First name:</strong> <strong>First name:</strong>

View File

@ -1,3 +1,5 @@
<%# Copyright (C) 2024 Manuel Bustillo %>
<h1>Editing guest</h1> <h1>Editing guest</h1>
<%= render "form", guest: @guest %> <%= render "form", guest: @guest %>

View File

@ -1,3 +1,5 @@
<%# Copyright (C) 2024 Manuel Bustillo %>
<p style="color: green"><%= notice %></p> <p style="color: green"><%= notice %></p>
<h1>Guests</h1> <h1>Guests</h1>

View File

@ -1,3 +1,5 @@
<%# Copyright (C) 2024 Manuel Bustillo %>
<h1>New guest</h1> <h1>New guest</h1>
<%= render "form", guest: @guest %> <%= render "form", guest: @guest %>

View File

@ -1,3 +1,5 @@
<%# Copyright (C) 2024 Manuel Bustillo %>
<p style="color: green"><%= notice %></p> <p style="color: green"><%= notice %></p>
<%= render @guest %> <%= render @guest %>

View File

@ -1,3 +1,5 @@
<%# Copyright (C) 2024 Manuel Bustillo %>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>

View File

@ -1,3 +1,5 @@
<%# Copyright (C) 2024 Manuel Bustillo %>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>

View File

@ -1 +1,3 @@
<%# Copyright (C) 2024 Manuel Bustillo %>
<%= yield %> <%= yield %>

View File

@ -1,3 +1,5 @@
<%# Copyright (C) 2024 Manuel Bustillo %>
<h1>Tables arrangements</h1> <h1>Tables arrangements</h1>
<ol> <ol>

View File

@ -1,3 +1,5 @@
<%# Copyright (C) 2024 Manuel Bustillo %>
<h1>ID: <%= @tables_arrangement.id %></h1> <h1>ID: <%= @tables_arrangement.id %></h1>
<p>Discomfort: <%= @tables_arrangement.discomfort %></p> <p>Discomfort: <%= @tables_arrangement.discomfort %></p>

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
require_relative 'boot' require_relative 'boot'
require 'rails' require 'rails'

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
require "bundler/setup" # Set up gems listed in the Gemfile. require "bundler/setup" # Set up gems listed in the Gemfile.

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
# Load the Rails application. # Load the Rails application.
require_relative "application" require_relative "application"

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
require "active_support/core_ext/integer/time" require "active_support/core_ext/integer/time"
Rails.application.configure do Rails.application.configure do

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
require "active_support/core_ext/integer/time" require "active_support/core_ext/integer/time"
Rails.application.configure do Rails.application.configure do

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
require "active_support/core_ext/integer/time" require "active_support/core_ext/integer/time"
# The test environment is used exclusively to run your application's # The test environment is used exclusively to run your application's

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
# Pin npm packages by running ./bin/importmap # Pin npm packages by running ./bin/importmap
pin "application" pin "application"

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
require_relative '../../app/services/affinity_groups_hierarchy' require_relative '../../app/services/affinity_groups_hierarchy'
hierarchy = AffinityGroupsHierarchy.instance hierarchy = AffinityGroupsHierarchy.instance

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets. # Version of your assets, change this if you want to expire all your assets.

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# Define an application-wide content security policy. # Define an application-wide content security policy.

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
# config/initializers/cors.rb # config/initializers/cors.rb
Rails.application.config.middleware.insert_before 0, Rack::Cors do Rails.application.config.middleware.insert_before 0, Rack::Cors do

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file. # Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections # Add new inflection rules using the following format. Inflections

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# Define an application-wide HTTP permissions policy. For further # Define an application-wide HTTP permissions policy. For further

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
class Numeric class Numeric
def to_currency def to_currency
Money.from_amount(self, "EUR").format Money.from_amount(self, "EUR").format

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
# This configuration file will be evaluated by Puma. The top-level methods that # This configuration file will be evaluated by Puma. The top-level methods that
# are invoked here are part of Puma's configuration DSL. For more information # are invoked here are part of Puma's configuration DSL. For more information
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html. # about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
Rails.application.routes.draw do Rails.application.routes.draw do
resources :groups, only: :index resources :groups, only: :index
resources :guests do resources :guests do

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
class CreateExpenses < ActiveRecord::Migration[7.1] class CreateExpenses < ActiveRecord::Migration[7.1]
def change def change
create_enum :pricing_types, ["fixed", "per_person"] create_enum :pricing_types, ["fixed", "per_person"]

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
class CreateGuests < ActiveRecord::Migration[7.1] class CreateGuests < ActiveRecord::Migration[7.1]
def change def change
create_table :guests, id: :uuid do |t| create_table :guests, id: :uuid do |t|

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
# frozen_string_literal: true # frozen_string_literal: true
# This migration comes from acts_as_taggable_on_engine (originally 1) # This migration comes from acts_as_taggable_on_engine (originally 1)

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
# frozen_string_literal: true # frozen_string_literal: true
# This migration comes from acts_as_taggable_on_engine (originally 2) # This migration comes from acts_as_taggable_on_engine (originally 2)

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
# frozen_string_literal: true # frozen_string_literal: true
# This migration comes from acts_as_taggable_on_engine (originally 3) # This migration comes from acts_as_taggable_on_engine (originally 3)

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
# frozen_string_literal: true # frozen_string_literal: true
# This migration comes from acts_as_taggable_on_engine (originally 4) # This migration comes from acts_as_taggable_on_engine (originally 4)

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
# frozen_string_literal: true # frozen_string_literal: true
# This migration comes from acts_as_taggable_on_engine (originally 5) # This migration comes from acts_as_taggable_on_engine (originally 5)

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
# frozen_string_literal: true # frozen_string_literal: true
# This migration comes from acts_as_taggable_on_engine (originally 6) # This migration comes from acts_as_taggable_on_engine (originally 6)

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
# frozen_string_literal: true # frozen_string_literal: true
# This migration comes from acts_as_taggable_on_engine (originally 7) # This migration comes from acts_as_taggable_on_engine (originally 7)

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
class CreateTablesArrangements < ActiveRecord::Migration[7.1] class CreateTablesArrangements < ActiveRecord::Migration[7.1]
def change def change
create_table :tables_arrangements, id: :uuid do |t| create_table :tables_arrangements, id: :uuid do |t|

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
class CreateSeats < ActiveRecord::Migration[7.1] class CreateSeats < ActiveRecord::Migration[7.1]
def change def change
create_table :seats, id: :uuid do |t| create_table :seats, id: :uuid do |t|

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
class CreateGroups < ActiveRecord::Migration[7.1] class CreateGroups < ActiveRecord::Migration[7.1]
def change def change
create_table :groups, id: :uuid do |t| create_table :groups, id: :uuid do |t|

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
class AddParentToGroup < ActiveRecord::Migration[7.1] class AddParentToGroup < ActiveRecord::Migration[7.1]
def change def change
add_reference :groups, :parent, type: :uuid, index: true, foreign_key: { to_table: :groups } add_reference :groups, :parent, type: :uuid, index: true, foreign_key: { to_table: :groups }

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
class AddGroupToGuest < ActiveRecord::Migration[7.1] class AddGroupToGuest < ActiveRecord::Migration[7.1]
def change def change
add_reference :guests, :group, null: false, foreign_key: true, type: :uuid add_reference :guests, :group, null: false, foreign_key: true, type: :uuid

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
class AddStatusToGuest < ActiveRecord::Migration[7.1] class AddStatusToGuest < ActiveRecord::Migration[7.1]
def change def change
add_column :guests, :status, :integer, default: 0 add_column :guests, :status, :integer, default: 0

2
db/schema.rb generated
View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
# This file is auto-generated from the current state of the database. Instead # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to # of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition. # incrementally modify your database, and then regenerate this schema definition.

View File

@ -1,3 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
NUMBER_OF_GUESTS = 50 NUMBER_OF_GUESTS = 50
TablesArrangement.delete_all TablesArrangement.delete_all