Add copyright notice
This commit is contained in:
parent
f3172bb38f
commit
b7cabc1661
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
module ApplicationCable
|
||||
class Channel < ActionCable::Channel::Base
|
||||
end
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
module ApplicationCable
|
||||
class Connection < ActionCable::Connection::Base
|
||||
end
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
class ApplicationController < ActionController::Base
|
||||
after_action :set_csrf_cookie
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
class ExpensesController < ApplicationController
|
||||
before_action :set_expense, only: %i[ show edit update destroy ]
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
class GroupsController < ApplicationController
|
||||
def index
|
||||
roots = Group.where(parent_id: nil)
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
require 'csv'
|
||||
|
||||
class GuestsController < ApplicationController
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
class TablesArrangementsController < ApplicationController
|
||||
def index
|
||||
@tables_arrangements = TablesArrangement.all.order(discomfort: :asc).limit(10)
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
module TreeNodeExtension
|
||||
def distance_to_common_ancestor(another_node)
|
||||
return 0 if self == another_node
|
||||
|
@ -1,2 +1,4 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
module ApplicationHelper
|
||||
end
|
||||
|
@ -1,2 +1,4 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
module ExpensesHelper
|
||||
end
|
||||
|
@ -1,2 +1,4 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
module GroupsHelper
|
||||
end
|
||||
|
@ -1,2 +1,4 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
module GuestsHelper
|
||||
end
|
||||
|
@ -1,2 +1,4 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
module TablesArrangementsHelper
|
||||
end
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
class ApplicationJob < ActiveJob::Base
|
||||
# Automatically retry jobs that encountered a deadlock
|
||||
# retry_on ActiveRecord::Deadlocked
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
class ApplicationMailer < ActionMailer::Base
|
||||
default from: "from@example.com"
|
||||
layout "mailer"
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
class ApplicationRecord < ActiveRecord::Base
|
||||
primary_abstract_class
|
||||
end
|
||||
|
@ -1,2 +1,4 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
class Expense < ApplicationRecord
|
||||
end
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
class Group < ApplicationRecord
|
||||
validates :name, uniqueness: true
|
||||
validates :name, :order, presence: true
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
class Guest < ApplicationRecord
|
||||
acts_as_taggable_on :affinity_groups, :unbreakable_bonds
|
||||
belongs_to :group
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
class Seat < ApplicationRecord
|
||||
belongs_to :guest
|
||||
belongs_to :table_arrangement
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
class TablesArrangement < ApplicationRecord
|
||||
has_many :seats
|
||||
end
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
class SerializableGroup < JSONAPI::Serializable::Resource
|
||||
type 'group'
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
class SerializableGuest < JSONAPI::Serializable::Resource
|
||||
type 'guest'
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
class AffinityGroupsHierarchy < Array
|
||||
include Singleton
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
module Tables
|
||||
class DiscomfortCalculator
|
||||
private attr_reader :table
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
require_relative '../../extensions/tree_node_extension'
|
||||
|
||||
module Tables
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
module Tables
|
||||
class Swap
|
||||
private attr_reader :initial_solution
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
module Tables
|
||||
class Table < Array
|
||||
attr_accessor :discomfort
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
module VNS
|
||||
class Engine
|
||||
def target_function(&function)
|
||||
|
@ -1,3 +1,5 @@
|
||||
<%# Copyright (C) 2024 Manuel Bustillo %>
|
||||
|
||||
<div id="<%= dom_id expense %>">
|
||||
<p>
|
||||
<strong>Name:</strong>
|
||||
|
@ -1,3 +1,5 @@
|
||||
<%# Copyright (C) 2024 Manuel Bustillo %>
|
||||
|
||||
<%= form_with(model: expense) do |form| %>
|
||||
<% if expense.errors.any? %>
|
||||
<div style="color: red">
|
||||
|
@ -1,3 +1,5 @@
|
||||
<%# Copyright (C) 2024 Manuel Bustillo %>
|
||||
|
||||
<h1>Editing expense</h1>
|
||||
|
||||
<%= render "form", expense: @expense %>
|
||||
|
@ -1,3 +1,5 @@
|
||||
<%# Copyright (C) 2024 Manuel Bustillo %>
|
||||
|
||||
<p style="color: green"><%= notice %></p>
|
||||
|
||||
<h1>Expenses</h1>
|
||||
|
@ -1,3 +1,5 @@
|
||||
<%# Copyright (C) 2024 Manuel Bustillo %>
|
||||
|
||||
<h1>New expense</h1>
|
||||
|
||||
<%= render "form", expense: @expense %>
|
||||
|
@ -1,3 +1,5 @@
|
||||
<%# Copyright (C) 2024 Manuel Bustillo %>
|
||||
|
||||
<p style="color: green"><%= notice %></p>
|
||||
|
||||
<%= render @expense %>
|
||||
|
@ -1,3 +1,5 @@
|
||||
<%# Copyright (C) 2024 Manuel Bustillo %>
|
||||
|
||||
<%= form_with(model: guest) do |form| %>
|
||||
<% if guest.errors.any? %>
|
||||
<div style="color: red">
|
||||
|
@ -1,3 +1,5 @@
|
||||
<%# Copyright (C) 2024 Manuel Bustillo %>
|
||||
|
||||
<div id="<%= dom_id guest %>">
|
||||
<p>
|
||||
<strong>First name:</strong>
|
||||
|
@ -1,3 +1,5 @@
|
||||
<%# Copyright (C) 2024 Manuel Bustillo %>
|
||||
|
||||
<h1>Editing guest</h1>
|
||||
|
||||
<%= render "form", guest: @guest %>
|
||||
|
@ -1,3 +1,5 @@
|
||||
<%# Copyright (C) 2024 Manuel Bustillo %>
|
||||
|
||||
<p style="color: green"><%= notice %></p>
|
||||
|
||||
<h1>Guests</h1>
|
||||
|
@ -1,3 +1,5 @@
|
||||
<%# Copyright (C) 2024 Manuel Bustillo %>
|
||||
|
||||
<h1>New guest</h1>
|
||||
|
||||
<%= render "form", guest: @guest %>
|
||||
|
@ -1,3 +1,5 @@
|
||||
<%# Copyright (C) 2024 Manuel Bustillo %>
|
||||
|
||||
<p style="color: green"><%= notice %></p>
|
||||
|
||||
<%= render @guest %>
|
||||
|
@ -1,3 +1,5 @@
|
||||
<%# Copyright (C) 2024 Manuel Bustillo %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
@ -1,3 +1,5 @@
|
||||
<%# Copyright (C) 2024 Manuel Bustillo %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
@ -1 +1,3 @@
|
||||
<%# Copyright (C) 2024 Manuel Bustillo %>
|
||||
|
||||
<%= yield %>
|
||||
|
@ -1,3 +1,5 @@
|
||||
<%# Copyright (C) 2024 Manuel Bustillo %>
|
||||
|
||||
<h1>Tables arrangements</h1>
|
||||
|
||||
<ol>
|
||||
|
@ -1,3 +1,5 @@
|
||||
<%# Copyright (C) 2024 Manuel Bustillo %>
|
||||
|
||||
<h1>ID: <%= @tables_arrangement.id %></h1>
|
||||
|
||||
<p>Discomfort: <%= @tables_arrangement.discomfort %></p>
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
require_relative 'boot'
|
||||
|
||||
require 'rails'
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
||||
|
||||
require "bundler/setup" # Set up gems listed in the Gemfile.
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
# Load the Rails application.
|
||||
require_relative "application"
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
require "active_support/core_ext/integer/time"
|
||||
|
||||
Rails.application.configure do
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
require "active_support/core_ext/integer/time"
|
||||
|
||||
Rails.application.configure do
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
require "active_support/core_ext/integer/time"
|
||||
|
||||
# The test environment is used exclusively to run your application's
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
# Pin npm packages by running ./bin/importmap
|
||||
|
||||
pin "application"
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
require_relative '../../app/services/affinity_groups_hierarchy'
|
||||
|
||||
hierarchy = AffinityGroupsHierarchy.instance
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
# 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.
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Define an application-wide content security policy.
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
# config/initializers/cors.rb
|
||||
|
||||
Rails.application.config.middleware.insert_before 0, Rack::Cors do
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
# 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.
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Add new inflection rules using the following format. Inflections
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Define an application-wide HTTP permissions policy. For further
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
class Numeric
|
||||
def to_currency
|
||||
Money.from_amount(self, "EUR").format
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
# 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
|
||||
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
Rails.application.routes.draw do
|
||||
resources :groups, only: :index
|
||||
resources :guests do
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
class CreateExpenses < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
create_enum :pricing_types, ["fixed", "per_person"]
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
class CreateGuests < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
create_table :guests, id: :uuid do |t|
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
# frozen_string_literal: true
|
||||
|
||||
# This migration comes from acts_as_taggable_on_engine (originally 1)
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
# frozen_string_literal: true
|
||||
|
||||
# This migration comes from acts_as_taggable_on_engine (originally 2)
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
# frozen_string_literal: true
|
||||
|
||||
# This migration comes from acts_as_taggable_on_engine (originally 3)
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
# frozen_string_literal: true
|
||||
|
||||
# This migration comes from acts_as_taggable_on_engine (originally 4)
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
# frozen_string_literal: true
|
||||
|
||||
# This migration comes from acts_as_taggable_on_engine (originally 5)
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
# frozen_string_literal: true
|
||||
|
||||
# This migration comes from acts_as_taggable_on_engine (originally 6)
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
# frozen_string_literal: true
|
||||
|
||||
# This migration comes from acts_as_taggable_on_engine (originally 7)
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
class CreateTablesArrangements < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
create_table :tables_arrangements, id: :uuid do |t|
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
class CreateSeats < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
create_table :seats, id: :uuid do |t|
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
class CreateGroups < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
create_table :groups, id: :uuid do |t|
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
class AddParentToGroup < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
add_reference :groups, :parent, type: :uuid, index: true, foreign_key: { to_table: :groups }
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
class AddGroupToGuest < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
add_reference :guests, :group, null: false, foreign_key: true, type: :uuid
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
class AddStatusToGuest < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
add_column :guests, :status, :integer, default: 0
|
||||
|
2
db/schema.rb
generated
2
db/schema.rb
generated
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
# 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
|
||||
# incrementally modify your database, and then regenerate this schema definition.
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
NUMBER_OF_GUESTS = 50
|
||||
|
||||
TablesArrangement.delete_all
|
||||
|
Loading…
x
Reference in New Issue
Block a user