diff --git a/app/controllers/accounting_posts_controller.rb b/app/controllers/accounting_posts_controller.rb index 015e23011..b88f3bcb2 100644 --- a/app/controllers/accounting_posts_controller.rb +++ b/app/controllers/accounting_posts_controller.rb @@ -13,7 +13,7 @@ class AccountingPostsController < CrudController self.permitted_attrs = [:closed, :offered_hours, :offered_rate, :offered_total, :remaining_hours, :portfolio_item_id, :service_id, :billable, :description_required, :ticket_required, :from_to_times_required, - :meal_compensation, + :meal_compensation, :market_opportunity_id, { work_item_attributes: %i[name shortname description] }] helper_method :order diff --git a/app/controllers/market_opportunities_controller.rb b/app/controllers/market_opportunities_controller.rb new file mode 100644 index 000000000..457d86a26 --- /dev/null +++ b/app/controllers/market_opportunities_controller.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +# Copyright (c) 2006-2024, Puzzle ITC GmbH. This file is part of +# PuzzleTime and licensed under the Affero General Public License version 3 +# or later. See the COPYING file at the top-level directory or at +# https://github.com/puzzle/puzzletime. + +class MarketOpportunitiesController < ManageController + self.permitted_attrs = %i[name active] +end diff --git a/app/controllers/revenue_reports_controller.rb b/app/controllers/revenue_reports_controller.rb index 1c61b6d89..3bf32b095 100644 --- a/app/controllers/revenue_reports_controller.rb +++ b/app/controllers/revenue_reports_controller.rb @@ -13,6 +13,7 @@ class RevenueReportsController < ApplicationController Reports::Revenue::DepartmentOrder, Reports::Revenue::DepartmentMember, Reports::Revenue::PortfolioItem, + Reports::Revenue::MarketOpportunities, Reports::Revenue::Service, Reports::Revenue::Sector ].freeze diff --git a/app/domain/reports/revenue/market_opportunities.rb b/app/domain/reports/revenue/market_opportunities.rb new file mode 100644 index 000000000..d85c8e4b8 --- /dev/null +++ b/app/domain/reports/revenue/market_opportunities.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +# Copyright (c) 2006-2017, Puzzle ITC GmbH. This file is part of +# PuzzleTime and licensed under the Affero General Public License version 3 +# or later. See the COPYING file at the top-level directory or at +# https://github.com/puzzle/puzzletime. + +module Reports + module Revenue + class MarketOpportunities < Base + self.grouping_model = ::MarketOpportunity + self.grouping_fk = :market_opportunity_id + end + end +end diff --git a/app/models/ability.rb b/app/models/ability.rb index b57b1ba8c..d66fea69a 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -49,6 +49,7 @@ def management_abilities PortfolioItem, Sector, Service, + MarketOpportunity, TargetScope, UserNotification, WorkingCondition, diff --git a/app/models/absence.rb b/app/models/absence.rb index 92445f776..32694a992 100644 --- a/app/models/absence.rb +++ b/app/models/absence.rb @@ -5,6 +5,7 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: absences @@ -14,6 +15,11 @@ # payed :boolean default(FALSE) # vacation :boolean default(FALSE), not null # +# Indexes +# +# index_absences_on_name (name) UNIQUE +# +# }}} class Absence < ApplicationRecord include Evaluatable diff --git a/app/models/absencetime.rb b/app/models/absencetime.rb index b57b85e77..e2099b4da 100644 --- a/app/models/absencetime.rb +++ b/app/models/absencetime.rb @@ -5,25 +5,41 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: worktimes # -# id :integer not null, primary key -# absence_id :integer -# employee_id :integer -# report_type :string(255) not null -# work_date :date not null -# hours :float -# from_start_time :time -# to_end_time :time -# description :text -# billable :boolean default(TRUE) -# type :string(255) -# ticket :string(255) -# work_item_id :integer -# invoice_id :integer +# id :integer not null, primary key +# billable :boolean default(TRUE) +# description :text +# from_start_time :time +# hours :float +# internal_description :text +# meal_compensation :boolean default(FALSE), not null +# report_type :string(255) not null +# ticket :string(255) +# to_end_time :time +# type :string(255) +# work_date :date not null +# absence_id :integer +# employee_id :integer +# invoice_id :integer +# work_item_id :integer # +# Indexes +# +# index_worktimes_on_invoice_id (invoice_id) +# worktimes_absences (absence_id,employee_id,work_date) +# worktimes_employees (employee_id,work_date) +# worktimes_work_items (work_item_id,employee_id,work_date) +# +# Foreign Keys +# +# fk_times_absences (absence_id => absences.id) ON DELETE => cascade +# fk_times_employees (employee_id => employees.id) ON DELETE => cascade +# +# }}} class Absencetime < Worktime self.account_label = 'Absenz' diff --git a/app/models/accounting_post.rb b/app/models/accounting_post.rb index aff2f9037..081fdb1eb 100644 --- a/app/models/accounting_post.rb +++ b/app/models/accounting_post.rb @@ -5,24 +5,35 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: accounting_posts # # id :integer not null, primary key -# work_item_id :integer not null -# portfolio_item_id :integer +# billable :boolean default(TRUE), not null +# closed :boolean default(FALSE), not null +# description_required :boolean default(FALSE), not null +# from_to_times_required :boolean default(FALSE), not null +# meal_compensation :boolean default(FALSE), not null # offered_hours :float # offered_rate :decimal(12, 2) # offered_total :decimal(12, 2) # remaining_hours :integer -# billable :boolean default(TRUE), not null -# description_required :boolean default(FALSE), not null # ticket_required :boolean default(FALSE), not null -# closed :boolean default(FALSE), not null -# from_to_times_required :boolean default(FALSE), not null +# market_opportunity_id :integer +# portfolio_item_id :integer # service_id :integer +# work_item_id :integer not null +# +# Indexes +# +# index_accounting_posts_on_market_opportunity_id (market_opportunity_id) +# index_accounting_posts_on_portfolio_item_id (portfolio_item_id) +# index_accounting_posts_on_service_id (service_id) +# index_accounting_posts_on_work_item_id (work_item_id) # +# }}} class AccountingPost < ApplicationRecord include BelongingToWorkItem @@ -31,6 +42,7 @@ class AccountingPost < ApplicationRecord ### ASSOCIATIONS belongs_to :portfolio_item, optional: true + belongs_to :market_opportunity, optional: true belongs_to :service, optional: true has_ancestor_through_work_item :order diff --git a/app/models/additional_crm_order.rb b/app/models/additional_crm_order.rb index 6b079a480..03a461a2e 100644 --- a/app/models/additional_crm_order.rb +++ b/app/models/additional_crm_order.rb @@ -5,15 +5,21 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: additional_crm_orders # -# id :bigint(8) not null, primary key -# order_id :bigint(8) not null +# id :bigint not null, primary key # crm_key :string not null # name :string +# order_id :bigint not null # +# Indexes +# +# index_additional_crm_orders_on_order_id (order_id) +# +# }}} class AdditionalCrmOrder < ApplicationRecord belongs_to :order diff --git a/app/models/authentication.rb b/app/models/authentication.rb index e678c07cd..dbddba6f3 100644 --- a/app/models/authentication.rb +++ b/app/models/authentication.rb @@ -1,5 +1,24 @@ # frozen_string_literal: true +# {{{ +# == Schema Information +# +# Table name: authentications +# +# id :bigint not null, primary key +# provider :string +# token :string +# token_secret :string +# uid :string +# created_at :datetime not null +# updated_at :datetime not null +# employee_id :bigint +# +# Indexes +# +# index_authentications_on_employee_id (employee_id) +# +# }}} class Authentication < ApplicationRecord belongs_to :employee end diff --git a/app/models/billing_address.rb b/app/models/billing_address.rb index 7f96e7030..5202efc2d 100644 --- a/app/models/billing_address.rb +++ b/app/models/billing_address.rb @@ -5,20 +5,27 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: billing_addresses # # id :integer not null, primary key -# client_id :integer not null -# contact_id :integer -# supplement :string -# street :string -# zip_code :string -# town :string # country :string(2) # invoicing_key :string +# street :string +# supplement :string +# town :string +# zip_code :string +# client_id :integer not null +# contact_id :integer +# +# Indexes +# +# index_billing_addresses_on_client_id (client_id) +# index_billing_addresses_on_contact_id (contact_id) # +# }}} class BillingAddress < ApplicationRecord protect_if :invoices, diff --git a/app/models/client.rb b/app/models/client.rb index c652b5985..5128125bd 100644 --- a/app/models/client.rb +++ b/app/models/client.rb @@ -5,19 +5,26 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: clients # # id :integer not null, primary key -# work_item_id :integer not null -# crm_key :string # allow_local :boolean default(FALSE), not null -# last_invoice_number :integer default(0) +# crm_key :string +# e_bill_account_key :string # invoicing_key :string +# last_invoice_number :integer default(0) # sector_id :integer -# e_bill_account_key :string +# work_item_id :integer not null +# +# Indexes +# +# index_clients_on_sector_id (sector_id) +# index_clients_on_work_item_id (work_item_id) # +# }}} class Client < ApplicationRecord include BelongingToWorkItem diff --git a/app/models/contact.rb b/app/models/contact.rb index 58296e52c..f1390e29d 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -5,23 +5,29 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: contacts # # id :integer not null, primary key -# client_id :integer not null -# lastname :string +# crm_key :string +# email :string # firstname :string # function :string -# email :string -# phone :string +# invoicing_key :string +# lastname :string # mobile :string -# crm_key :string +# phone :string # created_at :datetime # updated_at :datetime -# invoicing_key :string +# client_id :integer not null +# +# Indexes +# +# index_contacts_on_client_id (client_id) # +# }}} class Contact < ApplicationRecord CRM_ID_PREFIX = 'crm_' diff --git a/app/models/contract.rb b/app/models/contract.rb index da68f4ece..c8fb6082b 100644 --- a/app/models/contract.rb +++ b/app/models/contract.rb @@ -5,19 +5,21 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: contracts # # id :integer not null, primary key -# number :string not null -# start_date :date not null # end_date :date not null +# notes :text +# number :string not null # payment_period :integer not null # reference :text # sla :text -# notes :text +# start_date :date not null # +# }}} class Contract < ApplicationRecord has_one :order diff --git a/app/models/custom_list.rb b/app/models/custom_list.rb index 6820cb577..cb5362a35 100644 --- a/app/models/custom_list.rb +++ b/app/models/custom_list.rb @@ -5,16 +5,18 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: custom_lists # # id :integer not null, primary key +# item_ids :integer not null, is an Array +# item_type :string not null # name :string not null # employee_id :integer -# item_type :string not null -# item_ids :integer not null, is an Array # +# }}} class CustomList < ApplicationRecord belongs_to :employee, optional: true diff --git a/app/models/department.rb b/app/models/department.rb index 7903fe3c3..2060098a0 100644 --- a/app/models/department.rb +++ b/app/models/department.rb @@ -5,6 +5,7 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: departments @@ -13,6 +14,12 @@ # name :string(255) not null # shortname :string(3) not null # +# Indexes +# +# index_departments_on_name (name) UNIQUE +# index_departments_on_shortname (shortname) UNIQUE +# +# }}} class Department < ApplicationRecord include Evaluatable diff --git a/app/models/employee.rb b/app/models/employee.rb index 52b6c0fdc..a873a3c31 100644 --- a/app/models/employee.rb +++ b/app/models/employee.rb @@ -4,41 +4,54 @@ # PuzzleTime and licensed under the Affero General Public License version 3 # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: employees # # id :integer not null, primary key -# firstname :string(255) not null -# lastname :string(255) not null -# shortname :string(3) not null -# passwd :string(255) +# additional_information :text +# birthday :date +# city :string +# committed_worktimes_at :date +# crm_key :string # email :string(255) not null -# management :boolean default(FALSE) +# emergency_contact_name :string +# emergency_contact_phone :string +# encrypted_password :string default("") +# eval_periods :string(3) is an Array +# firstname :string(255) not null +# graduation :string +# identity_card_type :string +# identity_card_valid_until :date # initial_vacation_days :float +# lastname :string(255) not null # ldapname :string(255) -# eval_periods :string(3) is an Array -# department_id :integer -# committed_worktimes_at :date -# probation_period_end_date :date +# management :boolean default(FALSE) +# marital_status :integer +# nationalities :string is an Array # phone_office :string # phone_private :string -# street :string # postal_code :string -# city :string -# birthday :date -# emergency_contact_name :string -# emergency_contact_phone :string -# marital_status :integer -# social_insurance :string -# crm_key :string -# additional_information :text +# probation_period_end_date :date +# remember_created_at :datetime # reviewed_worktimes_at :date -# nationalities :string is an Array -# graduation :string -# identity_card_type :string -# identity_card_valid_until :date +# shortname :string(3) not null +# social_insurance :string +# street :string +# worktimes_commit_reminder :boolean default(TRUE), not null +# created_at :datetime not null +# updated_at :datetime not null +# department_id :integer +# workplace_id :bigint +# +# Indexes +# +# chk_unique_name (shortname) UNIQUE +# index_employees_on_department_id (department_id) +# index_employees_on_workplace_id (workplace_id) # +# }}} class Employee < ApplicationRecord # Include default devise modules. Others available are: diff --git a/app/models/employment.rb b/app/models/employment.rb index 489d6504e..e04ff4497 100644 --- a/app/models/employment.rb +++ b/app/models/employment.rb @@ -5,18 +5,28 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: employments # # id :integer not null, primary key -# employee_id :integer +# comment :string +# end_date :date # percent :decimal(5, 2) not null # start_date :date not null -# end_date :date # vacation_days_per_year :decimal(5, 2) -# comment :string +# employee_id :integer +# +# Indexes +# +# index_employments_on_employee_id (employee_id) +# +# Foreign Keys +# +# fk_employments_employees (employee_id => employees.id) ON DELETE => cascade # +# }}} class Employment < ApplicationRecord DAYS_PER_YEAR = 365.25 diff --git a/app/models/employment_role.rb b/app/models/employment_role.rb index 6e1a9bc4c..eaaf1c8f6 100644 --- a/app/models/employment_role.rb +++ b/app/models/employment_role.rb @@ -5,16 +5,22 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: employment_roles # # id :integer not null, primary key -# name :string not null # billable :boolean not null # level :boolean not null +# name :string not null # employment_role_category_id :integer # +# Indexes +# +# index_employment_roles_on_name (name) UNIQUE +# +# }}} class EmploymentRole < ApplicationRecord belongs_to :employment_role_category, optional: true diff --git a/app/models/employment_role_category.rb b/app/models/employment_role_category.rb index 25be46f3d..223ea0b28 100644 --- a/app/models/employment_role_category.rb +++ b/app/models/employment_role_category.rb @@ -5,6 +5,7 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: employment_role_categories @@ -12,6 +13,11 @@ # id :integer not null, primary key # name :string not null # +# Indexes +# +# index_employment_role_categories_on_name (name) UNIQUE +# +# }}} class EmploymentRoleCategory < ApplicationRecord has_many :employment_roles, dependent: :restrict_with_exception diff --git a/app/models/employment_role_level.rb b/app/models/employment_role_level.rb index 0bcb0228e..6611625bb 100644 --- a/app/models/employment_role_level.rb +++ b/app/models/employment_role_level.rb @@ -5,6 +5,7 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: employment_role_levels @@ -12,6 +13,11 @@ # id :integer not null, primary key # name :string not null # +# Indexes +# +# index_employment_role_levels_on_name (name) UNIQUE +# +# }}} class EmploymentRoleLevel < ApplicationRecord has_many :employment_roles_employments, dependent: :restrict_with_exception diff --git a/app/models/employment_roles_employment.rb b/app/models/employment_roles_employment.rb index abd633752..5d3bee086 100644 --- a/app/models/employment_roles_employment.rb +++ b/app/models/employment_roles_employment.rb @@ -5,16 +5,22 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: employment_roles_employments # # id :integer not null, primary key +# percent :decimal(5, 2) not null # employment_id :integer not null # employment_role_id :integer not null # employment_role_level_id :integer -# percent :decimal(5, 2) not null # +# Indexes +# +# index_unique_employment_employment_role (employment_id,employment_role_id) UNIQUE +# +# }}} class EmploymentRolesEmployment < ApplicationRecord has_paper_trail(meta: { employee_id: ->(e) { e.employment.employee_id } }, skip: [:id]) diff --git a/app/models/expense.rb b/app/models/expense.rb index 28184733b..b020f6cb8 100644 --- a/app/models/expense.rb +++ b/app/models/expense.rb @@ -1,23 +1,32 @@ # frozen_string_literal: true +# {{{ # == Schema Information # # Table name: expenses # -# id :bigint(8) not null, primary key -# employee_id :bigint(8) not null -# kind :integer not null -# status :integer default("pending"), not null +# id :bigint not null, primary key # amount :decimal(12, 2) not null -# payment_date :date not null # description :text not null +# kind :integer not null +# payment_date :date not null # reason :text -# reviewer_id :bigint(8) -# reviewed_at :datetime -# order_id :bigint(8) # reimbursement_date :date +# reviewed_at :datetime +# status :integer default("pending"), not null # submission_date :date +# employee_id :bigint not null +# order_id :bigint +# reviewer_id :bigint +# +# Indexes +# +# index_expenses_on_employee_id (employee_id) +# index_expenses_on_order_id (order_id) +# index_expenses_on_reviewer_id (reviewer_id) +# index_expenses_on_status (status) # +# }}} class Expense < ApplicationRecord belongs_to :order diff --git a/app/models/holiday.rb b/app/models/holiday.rb index 92ca1d07c..b942e3918 100644 --- a/app/models/holiday.rb +++ b/app/models/holiday.rb @@ -5,6 +5,7 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: holidays @@ -13,6 +14,11 @@ # holiday_date :date not null # musthours_day :float not null # +# Indexes +# +# index_holidays_on_holiday_date (holiday_date) UNIQUE +# +# }}} class Holiday < ApplicationRecord include ActionView::Helpers::NumberHelper diff --git a/app/models/invoice.rb b/app/models/invoice.rb index 06fa39be2..b0e864a8e 100644 --- a/app/models/invoice.rb +++ b/app/models/invoice.rb @@ -5,26 +5,33 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: invoices # # id :integer not null, primary key -# order_id :integer not null # billing_date :date not null # due_date :date not null -# total_amount :decimal(12, 2) not null -# total_hours :float not null -# reference :string not null +# grouping :integer default("accounting_posts"), not null +# invoicing_key :string # period_from :date not null # period_to :date not null +# reference :string not null # status :string not null -# billing_address_id :integer not null -# invoicing_key :string +# total_amount :decimal(12, 2) not null +# total_hours :float not null # created_at :datetime # updated_at :datetime -# grouping :integer default("accounting_posts"), not null +# billing_address_id :integer not null +# order_id :integer not null +# +# Indexes +# +# index_invoices_on_billing_address_id (billing_address_id) +# index_invoices_on_order_id (order_id) # +# }}} class Invoice < ApplicationRecord STATUSES = %w[draft sent paid partially_paid cancelled deleted unknown].freeze diff --git a/app/models/market_opportunity.rb b/app/models/market_opportunity.rb new file mode 100644 index 000000000..65d43d821 --- /dev/null +++ b/app/models/market_opportunity.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +# Copyright (c) 2006-2024, Puzzle ITC GmbH. This file is part of +# PuzzleTime and licensed under the Affero General Public License version 3 +# or later. See the COPYING file at the top-level directory or at +# https://github.com/puzzle/puzzletime. + +# {{{ +# == Schema Information +# +# Table name: market_opportunities +# +# id :bigint not null, primary key +# active :boolean default(TRUE), not null +# name :string not null +# created_at :datetime not null +# updated_at :datetime not null +# +# Indexes +# +# index_market_opportunities_on_name (name) UNIQUE +# +# }}} + +class MarketOpportunity < ApplicationRecord + has_many :accounting_posts, dependent: :nullify + + scope :list, -> { order(:name) } + + protect_if :accounting_posts, 'Der Eintrag kann nicht gelöscht werden, da ihm noch Marktopportunitäten zugeordnet sind' + + validates_by_schema + validates :name, uniqueness: true + + def to_s + name + end +end diff --git a/app/models/order.rb b/app/models/order.rb index 9f2ef025f..8ec82f7e6 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -5,27 +5,39 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: orders # # id :integer not null, primary key -# work_item_id :integer not null -# kind_id :integer -# responsible_id :integer -# status_id :integer -# department_id :integer -# contract_id :integer -# billing_address_id :integer +# closed_at :date +# committed_at :date +# completed_at :date # crm_key :string +# major_chance_value :integer +# major_risk_value :integer # created_at :datetime # updated_at :datetime -# completed_at :date -# committed_at :date -# closed_at :date -# major_risk_value :integer -# major_chance_value :integer +# billing_address_id :integer +# contract_id :integer +# department_id :integer +# kind_id :integer +# responsible_id :integer +# status_id :integer +# work_item_id :integer not null +# +# Indexes +# +# index_orders_on_billing_address_id (billing_address_id) +# index_orders_on_contract_id (contract_id) +# index_orders_on_department_id (department_id) +# index_orders_on_kind_id (kind_id) +# index_orders_on_responsible_id (responsible_id) +# index_orders_on_status_id (status_id) +# index_orders_on_work_item_id (work_item_id) # +# }}} class Order < ApplicationRecord include BelongingToWorkItem diff --git a/app/models/order_chance.rb b/app/models/order_chance.rb index 268a07a58..6f5136246 100644 --- a/app/models/order_chance.rb +++ b/app/models/order_chance.rb @@ -5,20 +5,30 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: order_uncertainties # # id :integer not null, primary key -# order_id :integer not null -# type :string not null -# name :string not null -# probability :integer default("improbable"), not null # impact :integer default("none"), not null # measure :text +# name :string not null +# probability :integer default("improbable"), not null +# type :string not null # created_at :datetime not null # updated_at :datetime not null +# order_id :integer not null +# +# Indexes +# +# index_order_uncertainties_on_order_id (order_id) +# +# Foreign Keys +# +# fk_rails_... (order_id => orders.id) # +# }}} class OrderChance < OrderUncertainty private diff --git a/app/models/order_comment.rb b/app/models/order_comment.rb index 0c9b2e706..5bcc65734 100644 --- a/app/models/order_comment.rb +++ b/app/models/order_comment.rb @@ -5,18 +5,24 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: order_comments # # id :integer not null, primary key -# order_id :integer not null # text :text not null -# creator_id :integer -# updater_id :integer # created_at :datetime # updated_at :datetime +# creator_id :integer +# order_id :integer not null +# updater_id :integer +# +# Indexes +# +# index_order_comments_on_order_id (order_id) # +# }}} class OrderComment < ApplicationRecord ### ASSOCIATIONS diff --git a/app/models/order_contact.rb b/app/models/order_contact.rb index 38f9b4402..2f00f1aa6 100644 --- a/app/models/order_contact.rb +++ b/app/models/order_contact.rb @@ -5,15 +5,21 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: order_contacts # -# false :integer not null, primary key +# comment :string # contact_id :integer not null # order_id :integer not null -# comment :string # +# Indexes +# +# index_order_contacts_on_contact_id (contact_id) +# index_order_contacts_on_order_id (order_id) +# +# }}} class OrderContact < ApplicationRecord belongs_to :contact diff --git a/app/models/order_kind.rb b/app/models/order_kind.rb index 28ae72dcf..2f6568f93 100644 --- a/app/models/order_kind.rb +++ b/app/models/order_kind.rb @@ -5,6 +5,7 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: order_kinds @@ -12,6 +13,11 @@ # id :integer not null, primary key # name :string not null # +# Indexes +# +# index_order_kinds_on_name (name) UNIQUE +# +# }}} class OrderKind < ApplicationRecord has_many :orders, foreign_key: :kind_id diff --git a/app/models/order_risk.rb b/app/models/order_risk.rb index 667e07e65..607831d12 100644 --- a/app/models/order_risk.rb +++ b/app/models/order_risk.rb @@ -5,20 +5,30 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: order_uncertainties # # id :integer not null, primary key -# order_id :integer not null -# type :string not null -# name :string not null -# probability :integer default("improbable"), not null # impact :integer default("none"), not null # measure :text +# name :string not null +# probability :integer default("improbable"), not null +# type :string not null # created_at :datetime not null # updated_at :datetime not null +# order_id :integer not null +# +# Indexes +# +# index_order_uncertainties_on_order_id (order_id) +# +# Foreign Keys +# +# fk_rails_... (order_id => orders.id) # +# }}} class OrderRisk < OrderUncertainty private diff --git a/app/models/order_status.rb b/app/models/order_status.rb index 2cb8f9e65..65ca4ca8e 100644 --- a/app/models/order_status.rb +++ b/app/models/order_status.rb @@ -5,17 +5,24 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: order_statuses # # id :integer not null, primary key -# name :string not null -# style :string # closed :boolean default(FALSE), not null -# position :integer not null # default :boolean default(FALSE), not null +# name :string not null +# position :integer not null +# style :string +# +# Indexes +# +# index_order_statuses_on_name (name) UNIQUE +# index_order_statuses_on_position (position) # +# }}} class OrderStatus < ApplicationRecord STYLES = %w[default success info warning danger].freeze diff --git a/app/models/order_target.rb b/app/models/order_target.rb index c4fbf4da8..4d5053bc0 100644 --- a/app/models/order_target.rb +++ b/app/models/order_target.rb @@ -5,18 +5,25 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: order_targets # # id :integer not null, primary key -# order_id :integer not null -# target_scope_id :integer not null -# rating :string default("green"), not null # comment :text +# rating :string default("green"), not null # created_at :datetime # updated_at :datetime +# order_id :integer not null +# target_scope_id :integer not null +# +# Indexes +# +# index_order_targets_on_order_id (order_id) +# index_order_targets_on_target_scope_id (target_scope_id) # +# }}} class OrderTarget < ApplicationRecord RATINGS = %w[green orange red].freeze diff --git a/app/models/order_team_member.rb b/app/models/order_team_member.rb index 49f828726..5dfb7b1c3 100644 --- a/app/models/order_team_member.rb +++ b/app/models/order_team_member.rb @@ -5,15 +5,21 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: order_team_members # -# false :integer not null, primary key +# id :bigint not null, primary key +# comment :string # employee_id :integer not null # order_id :integer not null -# comment :string # +# Indexes +# +# index_order_team_members_on_employee_id_and_order_id (employee_id,order_id) UNIQUE +# +# }}} class OrderTeamMember < ApplicationRecord belongs_to :employee diff --git a/app/models/order_uncertainty.rb b/app/models/order_uncertainty.rb index a6261b6c8..4805a061b 100644 --- a/app/models/order_uncertainty.rb +++ b/app/models/order_uncertainty.rb @@ -5,20 +5,30 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: order_uncertainties # # id :integer not null, primary key -# order_id :integer not null -# type :string not null -# name :string not null -# probability :integer default("improbable"), not null # impact :integer default("none"), not null # measure :text +# name :string not null +# probability :integer default("improbable"), not null +# type :string not null # created_at :datetime not null # updated_at :datetime not null +# order_id :integer not null +# +# Indexes +# +# index_order_uncertainties_on_order_id (order_id) +# +# Foreign Keys +# +# fk_rails_... (order_id => orders.id) # +# }}} class OrderUncertainty < ApplicationRecord MEDIUM_THRESHOLD = 3 diff --git a/app/models/ordertime.rb b/app/models/ordertime.rb index 6736642eb..cba6c8e34 100644 --- a/app/models/ordertime.rb +++ b/app/models/ordertime.rb @@ -5,25 +5,41 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: worktimes # -# id :integer not null, primary key -# absence_id :integer -# employee_id :integer -# report_type :string(255) not null -# work_date :date not null -# hours :float -# from_start_time :time -# to_end_time :time -# description :text -# billable :boolean default(TRUE) -# type :string(255) -# ticket :string(255) -# work_item_id :integer -# invoice_id :integer +# id :integer not null, primary key +# billable :boolean default(TRUE) +# description :text +# from_start_time :time +# hours :float +# internal_description :text +# meal_compensation :boolean default(FALSE), not null +# report_type :string(255) not null +# ticket :string(255) +# to_end_time :time +# type :string(255) +# work_date :date not null +# absence_id :integer +# employee_id :integer +# invoice_id :integer +# work_item_id :integer # +# Indexes +# +# index_worktimes_on_invoice_id (invoice_id) +# worktimes_absences (absence_id,employee_id,work_date) +# worktimes_employees (employee_id,work_date) +# worktimes_work_items (work_item_id,employee_id,work_date) +# +# Foreign Keys +# +# fk_times_absences (absence_id => absences.id) ON DELETE => cascade +# fk_times_employees (employee_id => employees.id) ON DELETE => cascade +# +# }}} class Ordertime < Worktime self.account_label = 'Position' diff --git a/app/models/overtime_vacation.rb b/app/models/overtime_vacation.rb index 683516d5e..c54d2a511 100644 --- a/app/models/overtime_vacation.rb +++ b/app/models/overtime_vacation.rb @@ -5,15 +5,21 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: overtime_vacations # # id :integer not null, primary key # hours :float not null -# employee_id :integer not null # transfer_date :date not null +# employee_id :integer not null +# +# Indexes +# +# index_overtime_vacations_on_employee_id (employee_id) # +# }}} class OvertimeVacation < ApplicationRecord belongs_to :employee diff --git a/app/models/planning.rb b/app/models/planning.rb index ea5f05d10..2cdfe2412 100644 --- a/app/models/planning.rb +++ b/app/models/planning.rb @@ -5,17 +5,25 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: plannings # # id :integer not null, primary key -# employee_id :integer not null -# work_item_id :integer not null # date :date not null -# percent :integer not null # definitive :boolean default(FALSE), not null +# percent :integer not null +# employee_id :integer not null +# work_item_id :integer not null +# +# Indexes +# +# index_plannings_on_employee_id (employee_id) +# index_plannings_on_employee_id_and_work_item_id_and_date (employee_id,work_item_id,date) UNIQUE +# index_plannings_on_work_item_id (work_item_id) # +# }}} class Planning < ApplicationRecord validates_by_schema diff --git a/app/models/portfolio_item.rb b/app/models/portfolio_item.rb index 230889fb9..9ba8e10bc 100644 --- a/app/models/portfolio_item.rb +++ b/app/models/portfolio_item.rb @@ -5,14 +5,20 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: portfolio_items # # id :integer not null, primary key -# name :string not null # active :boolean default(TRUE), not null +# name :string not null +# +# Indexes +# +# index_portfolio_items_on_name (name) UNIQUE # +# }}} class PortfolioItem < ApplicationRecord has_many :accounting_posts diff --git a/app/models/sector.rb b/app/models/sector.rb index 89d7994e4..7d7593d54 100644 --- a/app/models/sector.rb +++ b/app/models/sector.rb @@ -5,14 +5,16 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: sectors # # id :integer not null, primary key -# name :string not null # active :boolean default(TRUE), not null +# name :string not null # +# }}} class Sector < ApplicationRecord has_many :clients, dependent: :nullify diff --git a/app/models/service.rb b/app/models/service.rb index b7a27029c..c190031ea 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -5,14 +5,16 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: services # # id :integer not null, primary key -# name :string not null # active :boolean default(TRUE), not null +# name :string not null # +# }}} class Service < ApplicationRecord has_many :accounting_posts diff --git a/app/models/target_scope.rb b/app/models/target_scope.rb index 74fe02eaf..d603b3d86 100644 --- a/app/models/target_scope.rb +++ b/app/models/target_scope.rb @@ -5,18 +5,25 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: target_scopes # # id :integer not null, primary key -# name :string not null # icon :string +# name :string not null # position :integer not null # rating_green_description :string # rating_orange_description :string # rating_red_description :string # +# Indexes +# +# index_target_scopes_on_name (name) UNIQUE +# index_target_scopes_on_position (position) +# +# }}} class TargetScope < ApplicationRecord has_many :order_targets, dependent: :destroy diff --git a/app/models/user_notification.rb b/app/models/user_notification.rb index 8bbec71d9..ff16af0f4 100644 --- a/app/models/user_notification.rb +++ b/app/models/user_notification.rb @@ -5,6 +5,7 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: user_notifications @@ -14,6 +15,11 @@ # date_to :date # message :text not null # +# Indexes +# +# index_user_notifications_on_date_from_and_date_to (date_from,date_to) +# +# }}} class UserNotification < ApplicationRecord include Comparable diff --git a/app/models/work_item.rb b/app/models/work_item.rb index b8204aef5..70852e0a6 100644 --- a/app/models/work_item.rb +++ b/app/models/work_item.rb @@ -5,21 +5,28 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: work_items # # id :integer not null, primary key -# parent_id :integer -# name :string not null -# shortname :string(5) not null +# closed :boolean default(FALSE), not null # description :text +# leaf :boolean default(TRUE), not null +# name :string not null # path_ids :integer is an Array -# path_shortnames :string # path_names :string(2047) -# leaf :boolean default(TRUE), not null -# closed :boolean default(FALSE), not null +# path_shortnames :string +# shortname :string(5) not null +# parent_id :integer +# +# Indexes +# +# index_work_items_on_parent_id (parent_id) +# index_work_items_on_path_ids (path_ids) # +# }}} class WorkItem < ApplicationRecord include Evaluatable diff --git a/app/models/working_condition.rb b/app/models/working_condition.rb index 6c50eb4d6..f6ae129e7 100644 --- a/app/models/working_condition.rb +++ b/app/models/working_condition.rb @@ -5,15 +5,17 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: working_conditions # # id :integer not null, primary key -# valid_from :date -# vacation_days_per_year :decimal(5, 2) not null # must_hours_per_day :decimal(4, 2) not null +# vacation_days_per_year :decimal(5, 2) not null +# valid_from :date # +# }}} class WorkingCondition < ApplicationRecord validates_by_schema diff --git a/app/models/workplace.rb b/app/models/workplace.rb index 26cfd7277..d74c9e214 100644 --- a/app/models/workplace.rb +++ b/app/models/workplace.rb @@ -1,9 +1,14 @@ # frozen_string_literal: true -# Copyright (c) 2006-2022, Puzzle ITC GmbH. This file is part of -# PuzzleTime and licensed under the Affero General Public License version 3 -# or later. See the COPYING file at the top-level directory or at -# https://github.com/puzzle/puzzletime. +# {{{ +# == Schema Information +# +# Table name: workplaces +# +# id :bigint not null, primary key +# name :string +# +# }}} class Workplace < ApplicationRecord validates_by_schema diff --git a/app/models/worktime.rb b/app/models/worktime.rb index 81b6f1a5f..e0a31ddd1 100644 --- a/app/models/worktime.rb +++ b/app/models/worktime.rb @@ -5,25 +5,41 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: worktimes # -# id :integer not null, primary key -# absence_id :integer -# employee_id :integer -# report_type :string(255) not null -# work_date :date not null -# hours :float -# from_start_time :time -# to_end_time :time -# description :text -# billable :boolean default(TRUE) -# type :string(255) -# ticket :string(255) -# work_item_id :integer -# invoice_id :integer +# id :integer not null, primary key +# billable :boolean default(TRUE) +# description :text +# from_start_time :time +# hours :float +# internal_description :text +# meal_compensation :boolean default(FALSE), not null +# report_type :string(255) not null +# ticket :string(255) +# to_end_time :time +# type :string(255) +# work_date :date not null +# absence_id :integer +# employee_id :integer +# invoice_id :integer +# work_item_id :integer # +# Indexes +# +# index_worktimes_on_invoice_id (invoice_id) +# worktimes_absences (absence_id,employee_id,work_date) +# worktimes_employees (employee_id,work_date) +# worktimes_work_items (work_item_id,employee_id,work_date) +# +# Foreign Keys +# +# fk_times_absences (absence_id => absences.id) ON DELETE => cascade +# fk_times_employees (employee_id => employees.id) ON DELETE => cascade +# +# }}} class Worktime < ApplicationRecord H_M = /^(\d*):([0-5]\d)/ diff --git a/app/views/accounting_posts/_form.html.haml b/app/views/accounting_posts/_form.html.haml index f0db1aa5f..0d42c5db0 100644 --- a/app/views/accounting_posts/_form.html.haml +++ b/app/views/accounting_posts/_form.html.haml @@ -32,6 +32,8 @@ = f.labeled_input_field :remaining_hours, addon: 'h' = f.labeled_input_field :portfolio_item_id, span: 5 = f.labeled_input_field :service_id, span: 5 + = f.labeled_input_field :market_opportunity_id, span: 5 + = f.labeled_input_field :billable, caption: 'Budgetposition ist standardmässig verrechenbar' - if Settings.meal_compensation.active = f.labeled_input_field :meal_compensation, caption: 'Verpflegungsentschädigung standardmässig vorsehen' diff --git a/app/views/configurations/index.html.haml b/app/views/configurations/index.html.haml index 6e345a820..5b30558d6 100644 --- a/app/views/configurations/index.html.haml +++ b/app/views/configurations/index.html.haml @@ -6,7 +6,7 @@ .row = render 'group', title: 'Zeiterfassung', models: [Holiday, UserNotification, Absence, WorkingCondition] - = render 'group', title: 'Gruppierungen', models: [PortfolioItem, Service, Sector] + = render 'group', title: 'Gruppierungen', models: [PortfolioItem, Service, MarketOpportunity, Sector] .row = render 'group', title: 'Aufträge', models: [OrderKind, OrderStatus, TargetScope] diff --git a/app/views/layouts/_menu.html.haml b/app/views/layouts/_menu.html.haml index 708870eb0..6625c6fd8 100644 --- a/app/views/layouts/_menu.html.haml +++ b/app/views/layouts/_menu.html.haml @@ -68,6 +68,7 @@ order_statuses_path, portfolio_items_path, services_path, + market_opportunities_path, sectors_path, target_scopes_path, working_conditions_path, diff --git a/config/locales/models.de-CH.yml b/config/locales/models.de-CH.yml index 75441a188..6d6843eab 100644 --- a/config/locales/models.de-CH.yml +++ b/config/locales/models.de-CH.yml @@ -28,12 +28,12 @@ de-CH: contract: one: Vertrag other: Verträge - department: - one: Organisationseinheit - other: Organisationseinheiten custom_list: one: Liste other: Listen + department: + one: Organisationseinheit + other: Organisationseinheiten employee: one: Member other: Members @@ -58,6 +58,9 @@ de-CH: invoice: one: Rechnung other: Rechnungen + market_opportunity: + one: Marktopportunität + other: Marktopportunitäten order: one: Auftrag other: Aufträge @@ -128,19 +131,20 @@ de-CH: absencetime: duration: Dauer accounting_post: - work_item_id: Position - portfolio_item_id: Portfolio - service_id: Dienstleistung - reference: Referenz + billable: Verrechenbar + closed: Geschlossen + description_required: Beschreibung erforderlich + market_opportunity_id: Marktopportunität + meal_compensation: Verpflegungsentschädigung offered_hours: Offerierte Stunden offered_rate: Offerierter Stundensatz + portfolio_item_id: Portfolio + reference: Referenz remaining_hours: Restaufwand report_type: Report Typ - billable: Verrechenbar - meal_compensation: Verpflegungsentschädigung - description_required: Beschreibung erforderlich + service_id: Dienstleistung ticket_required: Ticket erforderlich - closed: Geschlossen + work_item_id: Position billing_address: client_id: Kunde contact_id: Kontakt @@ -299,6 +303,9 @@ de-CH: deleted: Gelöscht cancelled: Storniert unknown: Unbekannt + market_opportunity: + name: Bezeichnung + active: Aktiv order: client: Kunde category: Kategorie diff --git a/config/locales/models.de-DE.yml b/config/locales/models.de-DE.yml index a9900e0e6..df7d621fc 100644 --- a/config/locales/models.de-DE.yml +++ b/config/locales/models.de-DE.yml @@ -55,6 +55,9 @@ de-DE: invoice: one: Rechnung other: Rechnungen + market_opportunity: + one: Marktopportunität + other: Marktopportunitäten order: one: Auftrag other: Aufträge @@ -122,19 +125,20 @@ de-DE: absencetime: duration: Dauer accounting_post: - work_item_id: Position - portfolio_item_id: Portfolio - service_id: Dienstleistung - reference: Referenz + billable: Verrechenbar + closed: Geschlossen + description_required: Beschreibung erforderlich + market_opportunity_id: Marktopportunität + meal_compensation: Verpflegungsentschädigung offered_hours: Angebotene Stunden offered_rate: Angebotener Stundensatz + portfolio_item_id: Portfolio + reference: Referenz remaining_hours: Restaufwand report_type: Report-Typ - billable: Verrechenbar - meal_compensation: Verpflegungsentschädigung - description_required: Beschreibung erforderlich + service_id: Dienstleistung ticket_required: Ticket erforderlich - closed: Geschlossen + work_item_id: Position billing_address: client_id: Kunde contact_id: Kontakt @@ -263,6 +267,9 @@ de-DE: deleted: Gelöscht cancelled: Storniert unknown: Unbekannt + market_opportunity: + name: Bezeichnung + active: Aktiv order: client: Kunde category: Kategorie diff --git a/config/routes.rb b/config/routes.rb index 2f6ad9c0f..97eedbb37 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -72,6 +72,8 @@ resources :holidays, except: [:show] + resources :market_opportunities, except: [:show] + resources :orders do collection do get :search diff --git a/db/migrate/20241029151119_create_market_opportunities.rb b/db/migrate/20241029151119_create_market_opportunities.rb new file mode 100644 index 000000000..ab27499b6 --- /dev/null +++ b/db/migrate/20241029151119_create_market_opportunities.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +# Copyright (c) 2006-2024, Puzzle ITC GmbH. This file is part of +# PuzzleTime and licensed under the Affero General Public License version 3 +# or later. See the COPYING file at the top-level directory or at +# https://github.com/puzzle/puzzletime. + +class CreateMarketOpportunities < ActiveRecord::Migration[7.1] + def change + create_table :market_opportunities do |t| + t.string :name, null: false, index: { unique: true } + t.boolean :active, null: false, default: true + + t.timestamps + end + + add_column :accounting_posts, :market_opportunity_id, :integer + add_index :accounting_posts, :market_opportunity_id + end +end diff --git a/db/schema.rb b/db/schema.rb index 1bd87b11b..1f5c47dd6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -35,6 +35,8 @@ t.boolean "closed", default: false, null: false t.integer "service_id" t.boolean "meal_compensation", default: false, null: false + t.integer "market_opportunity_id" + t.index ["market_opportunity_id"], name: "index_accounting_posts_on_market_opportunity_id" t.index ["portfolio_item_id"], name: "index_accounting_posts_on_portfolio_item_id" t.index ["service_id"], name: "index_accounting_posts_on_service_id" t.index ["work_item_id"], name: "index_accounting_posts_on_work_item_id" @@ -300,6 +302,14 @@ t.index ["work_item_id"], name: "index_invoices_work_items_on_work_item_id" end + create_table "market_opportunities", force: :cascade do |t| + t.string "name", null: false + t.boolean "active", default: true, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["name"], name: "index_market_opportunities_on_name", unique: true + end + create_table "order_comments", id: :serial, force: :cascade do |t| t.integer "order_id", null: false t.text "text", null: false diff --git a/db/seeds/market_opportunities.rb b/db/seeds/market_opportunities.rb new file mode 100644 index 000000000..e00b01da8 --- /dev/null +++ b/db/seeds/market_opportunities.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +# Copyright (c) 2006-2024, Puzzle ITC GmbH. This file is part of +# PuzzleTime and licensed under the Affero General Public License version 3 +# or later. See the COPYING file at the top-level directory or at +# https://github.com/puzzle/puzzletime. + +MarketOpportunity.seed( + :name, + { name: 'Market Opportunity 1' }, + { name: 'Market Opportunity 2' }, + { name: 'Market Opportunity 3' }, + { name: 'Market Opportunity 4', active: false } +) diff --git a/lib/tasks/auto_annotate_models.rake b/lib/tasks/auto_annotate_models.rake new file mode 100644 index 000000000..2affb96b6 --- /dev/null +++ b/lib/tasks/auto_annotate_models.rake @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +# NOTE: only doing this in development as some production environments (Heroku) +# NOTE: are sensitive to local FS writes, and besides -- it's just not proper +# NOTE: to have a dev-mode tool do its thing in production. +if Rails.env.development? + require 'annotate' + task :set_annotation_options do + # You can override any of these by setting an environment variable of the + # same name. + Annotate.set_defaults( + 'active_admin' => 'false', + 'additional_file_patterns' => [], + 'routes' => 'false', + 'models' => 'true', + 'position_in_routes' => 'before', + 'position_in_class' => 'before', + 'position_in_test' => 'before', + 'position_in_fixture' => 'before', + 'position_in_factory' => 'before', + 'position_in_serializer' => 'before', + 'show_foreign_keys' => 'true', + 'show_complete_foreign_keys' => 'false', + 'show_indexes' => 'true', + 'simple_indexes' => 'false', + 'model_dir' => 'app/models', + 'root_dir' => '', + 'include_version' => 'false', + 'require' => '', + 'exclude_tests' => 'false', + 'exclude_fixtures' => 'false', + 'exclude_factories' => 'false', + 'exclude_serializers' => 'false', + 'exclude_scaffolds' => 'true', + 'exclude_controllers' => 'true', + 'exclude_helpers' => 'true', + 'exclude_sti_subclasses' => 'false', + 'ignore_model_sub_dir' => 'false', + 'ignore_columns' => nil, + 'ignore_routes' => nil, + 'ignore_unknown_models' => 'false', + 'hide_limit_column_types' => 'integer,bigint,boolean', + 'hide_default_column_types' => 'json,jsonb,hstore', + 'skip_on_db_migrate' => 'false', + 'format_bare' => 'true', + 'format_rdoc' => 'false', + 'format_yard' => 'false', + 'format_markdown' => 'false', + 'sort' => 'false', + 'force' => 'false', + 'frozen' => 'false', + 'classified_sort' => 'true', + 'trace' => 'false', + 'wrapper_open' => '{{{', + 'wrapper_close' => '}}}', + 'with_comment' => 'true' + ) + end + + Annotate.load_tasks +end diff --git a/node_modules/.yarn-integrity b/node_modules/.yarn-integrity deleted file mode 100644 index 74953049e..000000000 --- a/node_modules/.yarn-integrity +++ /dev/null @@ -1,12 +0,0 @@ -{ - "systemParams": "linux-x64-83", - "modulesFolders": [ - "node_modules" - ], - "flags": [], - "linkedModules": [], - "topLevelPatterns": [], - "lockfileEntries": {}, - "files": [], - "artifacts": {} -} \ No newline at end of file diff --git a/test/controllers/market_opportunities_controller_test.rb b/test/controllers/market_opportunities_controller_test.rb new file mode 100644 index 000000000..025621290 --- /dev/null +++ b/test/controllers/market_opportunities_controller_test.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Copyright (c) 2006-2024, Puzzle ITC GmbH. This file is part of +# PuzzleTime and licensed under the Affero General Public License version 3 +# or later. See the COPYING file at the top-level directory or at +# https://github.com/puzzle/puzzletime. + +require 'test_helper' + +class MarketOpportunitiesControllerTest < ActionDispatch::IntegrationTest + include CrudControllerTestHelper + + setup :login + + not_existing :test_show, + :test_show_json, + :test_show_with_non_existing_id_raises_record_not_found + + private + + # Test object used in several tests. + def test_entry + market_opportunities(:one) + end + + # Attribute hash used in several tests. + def test_entry_attrs + { name: 'Marktopportunität', active: true } + end +end diff --git a/test/fabricators/accounting_post_fabricator.rb b/test/fabricators/accounting_post_fabricator.rb index e36070c20..3c18f6582 100644 --- a/test/fabricators/accounting_post_fabricator.rb +++ b/test/fabricators/accounting_post_fabricator.rb @@ -5,24 +5,35 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: accounting_posts # # id :integer not null, primary key -# work_item_id :integer not null -# portfolio_item_id :integer +# billable :boolean default(TRUE), not null +# closed :boolean default(FALSE), not null +# description_required :boolean default(FALSE), not null +# from_to_times_required :boolean default(FALSE), not null +# meal_compensation :boolean default(FALSE), not null # offered_hours :float # offered_rate :decimal(12, 2) # offered_total :decimal(12, 2) # remaining_hours :integer -# billable :boolean default(TRUE), not null -# description_required :boolean default(FALSE), not null # ticket_required :boolean default(FALSE), not null -# from_to_times_required :boolean default(FALSE), not null -# closed :boolean default(FALSE), not null +# market_opportunity_id :integer +# portfolio_item_id :integer # service_id :integer +# work_item_id :integer not null +# +# Indexes +# +# index_accounting_posts_on_market_opportunity_id (market_opportunity_id) +# index_accounting_posts_on_portfolio_item_id (portfolio_item_id) +# index_accounting_posts_on_service_id (service_id) +# index_accounting_posts_on_work_item_id (work_item_id) # +# }}} Fabricator(:accounting_post) do work_item { Fabricate(:work_item, parent_id: Fabricate(:order).work_item_id) } diff --git a/test/fabricators/billing_address_fabricator.rb b/test/fabricators/billing_address_fabricator.rb index 7df7a3d60..f1821645d 100644 --- a/test/fabricators/billing_address_fabricator.rb +++ b/test/fabricators/billing_address_fabricator.rb @@ -5,20 +5,27 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: billing_addresses # # id :integer not null, primary key -# client_id :integer not null -# contact_id :integer -# supplement :string -# street :string -# zip_code :string -# town :string # country :string(2) # invoicing_key :string +# street :string +# supplement :string +# town :string +# zip_code :string +# client_id :integer not null +# contact_id :integer +# +# Indexes +# +# index_billing_addresses_on_client_id (client_id) +# index_billing_addresses_on_contact_id (contact_id) # +# }}} Fabricator(:billing_address) do client diff --git a/test/fabricators/client_fabricator.rb b/test/fabricators/client_fabricator.rb index b02d88d09..cf870e6d3 100644 --- a/test/fabricators/client_fabricator.rb +++ b/test/fabricators/client_fabricator.rb @@ -5,19 +5,26 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: clients # # id :integer not null, primary key -# work_item_id :integer not null -# crm_key :string # allow_local :boolean default(FALSE), not null -# last_invoice_number :integer default(0) +# crm_key :string +# e_bill_account_key :string # invoicing_key :string +# last_invoice_number :integer default(0) # sector_id :integer -# e_bill_account_key :string +# work_item_id :integer not null +# +# Indexes +# +# index_clients_on_sector_id (sector_id) +# index_clients_on_work_item_id (work_item_id) # +# }}} Fabricator(:client) do work_item diff --git a/test/fabricators/contact_fabricator.rb b/test/fabricators/contact_fabricator.rb index 8368b86ee..79213cc8e 100644 --- a/test/fabricators/contact_fabricator.rb +++ b/test/fabricators/contact_fabricator.rb @@ -5,23 +5,29 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: contacts # # id :integer not null, primary key -# client_id :integer not null -# lastname :string +# crm_key :string +# email :string # firstname :string # function :string -# email :string -# phone :string +# invoicing_key :string +# lastname :string # mobile :string -# crm_key :string +# phone :string # created_at :datetime # updated_at :datetime -# invoicing_key :string +# client_id :integer not null +# +# Indexes +# +# index_contacts_on_client_id (client_id) # +# }}} Fabricator(:contact) do client diff --git a/test/fabricators/contract_fabricator.rb b/test/fabricators/contract_fabricator.rb index ee854cd08..da0bb63b0 100644 --- a/test/fabricators/contract_fabricator.rb +++ b/test/fabricators/contract_fabricator.rb @@ -5,19 +5,21 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: contracts # # id :integer not null, primary key -# number :string not null -# start_date :date not null # end_date :date not null +# notes :text +# number :string not null # payment_period :integer not null # reference :text # sla :text -# notes :text +# start_date :date not null # +# }}} Fabricator(:contract) do order diff --git a/test/fabricators/department_fabricator.rb b/test/fabricators/department_fabricator.rb index f1f533eaa..eb5f42833 100644 --- a/test/fabricators/department_fabricator.rb +++ b/test/fabricators/department_fabricator.rb @@ -5,6 +5,7 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: departments @@ -13,6 +14,12 @@ # name :string(255) not null # shortname :string(3) not null # +# Indexes +# +# index_departments_on_name (name) UNIQUE +# index_departments_on_shortname (shortname) UNIQUE +# +# }}} Fabricator(:department) do name { Faker::Company.suffix } diff --git a/test/fabricators/employee_fabricator.rb b/test/fabricators/employee_fabricator.rb index b7a17ec74..2e4ad574d 100644 --- a/test/fabricators/employee_fabricator.rb +++ b/test/fabricators/employee_fabricator.rb @@ -4,41 +4,54 @@ # PuzzleTime and licensed under the Affero General Public License version 3 # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: employees # # id :integer not null, primary key -# firstname :string(255) not null -# lastname :string(255) not null -# shortname :string(3) not null -# passwd :string(255) +# additional_information :text +# birthday :date +# city :string +# committed_worktimes_at :date +# crm_key :string # email :string(255) not null -# management :boolean default(FALSE) +# emergency_contact_name :string +# emergency_contact_phone :string +# encrypted_password :string default("") +# eval_periods :string(3) is an Array +# firstname :string(255) not null +# graduation :string +# identity_card_type :string +# identity_card_valid_until :date # initial_vacation_days :float +# lastname :string(255) not null # ldapname :string(255) -# eval_periods :string(3) is an Array -# department_id :integer -# committed_worktimes_at :date -# probation_period_end_date :date +# management :boolean default(FALSE) +# marital_status :integer +# nationalities :string is an Array # phone_office :string # phone_private :string -# street :string # postal_code :string -# city :string -# birthday :date -# emergency_contact_name :string -# emergency_contact_phone :string -# marital_status :integer -# social_insurance :string -# crm_key :string -# additional_information :text +# probation_period_end_date :date +# remember_created_at :datetime # reviewed_worktimes_at :date -# nationalities :string is an Array -# graduation :string -# identity_card_type :string -# identity_card_valid_until :date +# shortname :string(3) not null +# social_insurance :string +# street :string +# worktimes_commit_reminder :boolean default(TRUE), not null +# created_at :datetime not null +# updated_at :datetime not null +# department_id :integer +# workplace_id :bigint +# +# Indexes +# +# chk_unique_name (shortname) UNIQUE +# index_employees_on_department_id (department_id) +# index_employees_on_workplace_id (workplace_id) # +# }}} Fabricator(:employee) do firstname { Faker::Name.first_name } diff --git a/test/fabricators/employment_fabricator.rb b/test/fabricators/employment_fabricator.rb index 7a00c9ebf..57b3e475b 100644 --- a/test/fabricators/employment_fabricator.rb +++ b/test/fabricators/employment_fabricator.rb @@ -5,18 +5,28 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: employments # # id :integer not null, primary key -# employee_id :integer +# comment :string +# end_date :date # percent :decimal(5, 2) not null # start_date :date not null -# end_date :date # vacation_days_per_year :decimal(5, 2) -# comment :string +# employee_id :integer +# +# Indexes +# +# index_employments_on_employee_id (employee_id) +# +# Foreign Keys +# +# fk_employments_employees (employee_id => employees.id) ON DELETE => cascade # +# }}} Fabricator(:employment) do employee diff --git a/test/fabricators/employment_role_fabricator.rb b/test/fabricators/employment_role_fabricator.rb index 6cd2cd4c9..b8e6ae9fa 100644 --- a/test/fabricators/employment_role_fabricator.rb +++ b/test/fabricators/employment_role_fabricator.rb @@ -1,15 +1,21 @@ # frozen_string_literal: true +# {{{ # == Schema Information # # Table name: employment_roles # # id :integer not null, primary key -# name :string not null # billable :boolean not null # level :boolean not null +# name :string not null # employment_role_category_id :integer # +# Indexes +# +# index_employment_roles_on_name (name) UNIQUE +# +# }}} Fabricator(:employment_role) do name { sequence(:employment_role) { |i| "employment-role-#{i}" } } diff --git a/test/fabricators/employment_roles_employment_fabricator.rb b/test/fabricators/employment_roles_employment_fabricator.rb index fbbd9c740..e46c8773b 100644 --- a/test/fabricators/employment_roles_employment_fabricator.rb +++ b/test/fabricators/employment_roles_employment_fabricator.rb @@ -1,15 +1,21 @@ # frozen_string_literal: true +# {{{ # == Schema Information # # Table name: employment_roles_employments # # id :integer not null, primary key +# percent :decimal(5, 2) not null # employment_id :integer not null # employment_role_id :integer not null # employment_role_level_id :integer -# percent :decimal(5, 2) not null # +# Indexes +# +# index_unique_employment_employment_role (employment_id,employment_role_id) UNIQUE +# +# }}} Fabricator(:employment_roles_employment) do employment_role diff --git a/test/fabricators/invoice_fabricator.rb b/test/fabricators/invoice_fabricator.rb index c44859ac5..cb5cde491 100644 --- a/test/fabricators/invoice_fabricator.rb +++ b/test/fabricators/invoice_fabricator.rb @@ -5,26 +5,33 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: invoices # # id :integer not null, primary key -# order_id :integer not null # billing_date :date not null # due_date :date not null -# total_amount :decimal(12, 2) not null -# total_hours :float not null -# reference :string not null +# grouping :integer default("accounting_posts"), not null +# invoicing_key :string # period_from :date not null # period_to :date not null +# reference :string not null # status :string not null -# billing_address_id :integer not null -# invoicing_key :string +# total_amount :decimal(12, 2) not null +# total_hours :float not null # created_at :datetime # updated_at :datetime -# grouping :integer default("accounting_posts"), not null +# billing_address_id :integer not null +# order_id :integer not null +# +# Indexes +# +# index_invoices_on_billing_address_id (billing_address_id) +# index_invoices_on_order_id (order_id) # +# }}} Fabricator(:invoice) do order diff --git a/test/fabricators/order_fabricator.rb b/test/fabricators/order_fabricator.rb index a593e7c32..2e425c5a4 100644 --- a/test/fabricators/order_fabricator.rb +++ b/test/fabricators/order_fabricator.rb @@ -5,27 +5,39 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: orders # # id :integer not null, primary key -# work_item_id :integer not null -# kind_id :integer -# responsible_id :integer -# status_id :integer -# department_id :integer -# contract_id :integer -# billing_address_id :integer +# closed_at :date +# committed_at :date +# completed_at :date # crm_key :string +# major_chance_value :integer +# major_risk_value :integer # created_at :datetime # updated_at :datetime -# completed_at :date -# committed_at :date -# closed_at :date -# major_risk_value :integer -# major_chance_value :integer +# billing_address_id :integer +# contract_id :integer +# department_id :integer +# kind_id :integer +# responsible_id :integer +# status_id :integer +# work_item_id :integer not null +# +# Indexes +# +# index_orders_on_billing_address_id (billing_address_id) +# index_orders_on_contract_id (contract_id) +# index_orders_on_department_id (department_id) +# index_orders_on_kind_id (kind_id) +# index_orders_on_responsible_id (responsible_id) +# index_orders_on_status_id (status_id) +# index_orders_on_work_item_id (work_item_id) # +# }}} Fabricator(:order) do work_item { Fabricate(:work_item, parent_id: Fabricate(:client).work_item_id) } diff --git a/test/fabricators/order_kind_fabricator.rb b/test/fabricators/order_kind_fabricator.rb index 3ebde68f0..9e4a79291 100644 --- a/test/fabricators/order_kind_fabricator.rb +++ b/test/fabricators/order_kind_fabricator.rb @@ -5,6 +5,7 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: order_kinds @@ -12,6 +13,11 @@ # id :integer not null, primary key # name :string not null # +# Indexes +# +# index_order_kinds_on_name (name) UNIQUE +# +# }}} Fabricator(:order_kind) do name { Faker::Hacker.noun } diff --git a/test/fabricators/order_status_fabricator.rb b/test/fabricators/order_status_fabricator.rb index 1b08044ce..a5faaa8d5 100644 --- a/test/fabricators/order_status_fabricator.rb +++ b/test/fabricators/order_status_fabricator.rb @@ -5,17 +5,24 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: order_statuses # # id :integer not null, primary key -# name :string not null -# style :string # closed :boolean default(FALSE), not null -# position :integer not null # default :boolean default(FALSE), not null +# name :string not null +# position :integer not null +# style :string +# +# Indexes +# +# index_order_statuses_on_name (name) UNIQUE +# index_order_statuses_on_position (position) # +# }}} Fabricator(:order_status) do name { Faker::Hacker.ingverb } diff --git a/test/fabricators/planning_fabricator.rb b/test/fabricators/planning_fabricator.rb index 7ad1a1ff0..9760bb2c8 100644 --- a/test/fabricators/planning_fabricator.rb +++ b/test/fabricators/planning_fabricator.rb @@ -5,17 +5,25 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: plannings # # id :integer not null, primary key -# employee_id :integer not null -# work_item_id :integer not null # date :date not null -# percent :integer not null # definitive :boolean default(FALSE), not null +# percent :integer not null +# employee_id :integer not null +# work_item_id :integer not null +# +# Indexes +# +# index_plannings_on_employee_id (employee_id) +# index_plannings_on_employee_id_and_work_item_id_and_date (employee_id,work_item_id,date) UNIQUE +# index_plannings_on_work_item_id (work_item_id) # +# }}} Fabricator(:planning) do |_f| date { Time.zone.now.at_beginning_of_week.to_date + rand(5) } diff --git a/test/fabricators/work_item_fabricator.rb b/test/fabricators/work_item_fabricator.rb index 6895eb1c8..e5deae340 100644 --- a/test/fabricators/work_item_fabricator.rb +++ b/test/fabricators/work_item_fabricator.rb @@ -5,21 +5,28 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: work_items # # id :integer not null, primary key -# parent_id :integer -# name :string not null -# shortname :string(5) not null +# closed :boolean default(FALSE), not null # description :text +# leaf :boolean default(TRUE), not null +# name :string not null # path_ids :integer is an Array -# path_shortnames :string # path_names :string(2047) -# leaf :boolean default(TRUE), not null -# closed :boolean default(FALSE), not null +# path_shortnames :string +# shortname :string(5) not null +# parent_id :integer +# +# Indexes +# +# index_work_items_on_parent_id (parent_id) +# index_work_items_on_path_ids (path_ids) # +# }}} Fabricator(:work_item) do name { Faker::Company.name } diff --git a/test/fabricators/worktime_fabricator.rb b/test/fabricators/worktime_fabricator.rb index 364799823..a58ea1a06 100644 --- a/test/fabricators/worktime_fabricator.rb +++ b/test/fabricators/worktime_fabricator.rb @@ -5,25 +5,41 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: worktimes # -# id :integer not null, primary key -# absence_id :integer -# employee_id :integer -# report_type :string(255) not null -# work_date :date not null -# hours :float -# from_start_time :time -# to_end_time :time -# description :text -# billable :boolean default(TRUE) -# type :string(255) -# ticket :string(255) -# work_item_id :integer -# invoice_id :integer +# id :integer not null, primary key +# billable :boolean default(TRUE) +# description :text +# from_start_time :time +# hours :float +# internal_description :text +# meal_compensation :boolean default(FALSE), not null +# report_type :string(255) not null +# ticket :string(255) +# to_end_time :time +# type :string(255) +# work_date :date not null +# absence_id :integer +# employee_id :integer +# invoice_id :integer +# work_item_id :integer # +# Indexes +# +# index_worktimes_on_invoice_id (invoice_id) +# worktimes_absences (absence_id,employee_id,work_date) +# worktimes_employees (employee_id,work_date) +# worktimes_work_items (work_item_id,employee_id,work_date) +# +# Foreign Keys +# +# fk_times_absences (absence_id => absences.id) ON DELETE => cascade +# fk_times_employees (employee_id => employees.id) ON DELETE => cascade +# +# }}} Fabricator(:ordertime) do work_date { Time.zone.today } diff --git a/test/fixtures/absences.yml b/test/fixtures/absences.yml index 5dc9315d8..7cec81ea0 100644 --- a/test/fixtures/absences.yml +++ b/test/fixtures/absences.yml @@ -4,6 +4,7 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: absences @@ -13,6 +14,11 @@ # payed :boolean default(FALSE) # vacation :boolean default(FALSE), not null # +# Indexes +# +# index_absences_on_name (name) UNIQUE +# +# }}} # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html diff --git a/test/fixtures/accounting_posts.yml b/test/fixtures/accounting_posts.yml index 05f65cf18..ee6556922 100644 --- a/test/fixtures/accounting_posts.yml +++ b/test/fixtures/accounting_posts.yml @@ -4,24 +4,35 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: accounting_posts # # id :integer not null, primary key -# work_item_id :integer not null -# portfolio_item_id :integer +# billable :boolean default(TRUE), not null +# closed :boolean default(FALSE), not null +# description_required :boolean default(FALSE), not null +# from_to_times_required :boolean default(FALSE), not null +# meal_compensation :boolean default(FALSE), not null # offered_hours :float # offered_rate :decimal(12, 2) # offered_total :decimal(12, 2) # remaining_hours :integer -# billable :boolean default(TRUE), not null -# description_required :boolean default(FALSE), not null # ticket_required :boolean default(FALSE), not null -# closed :boolean default(FALSE), not null -# from_to_times_required :boolean default(FALSE), not null +# market_opportunity_id :integer +# portfolio_item_id :integer # service_id :integer +# work_item_id :integer not null +# +# Indexes +# +# index_accounting_posts_on_market_opportunity_id (market_opportunity_id) +# index_accounting_posts_on_portfolio_item_id (portfolio_item_id) +# index_accounting_posts_on_service_id (service_id) +# index_accounting_posts_on_work_item_id (work_item_id) # +# }}} --- allgemein: diff --git a/test/fixtures/authentications.yml b/test/fixtures/authentications.yml index c82b4b95a..7c552eec5 100644 --- a/test/fixtures/authentications.yml +++ b/test/fixtures/authentications.yml @@ -1,4 +1,22 @@ -# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# {{{ +# == Schema Information +# +# Table name: authentications +# +# id :bigint not null, primary key +# provider :string +# token :string +# token_secret :string +# uid :string +# created_at :datetime not null +# updated_at :datetime not null +# employee_id :bigint +# +# Indexes +# +# index_authentications_on_employee_id (employee_id) +# +# }}} # This model initially had no columns defined. If you add columns to the # model remove the '{}' from the fixture names and add the columns immediately diff --git a/test/fixtures/billing_addresses.yml b/test/fixtures/billing_addresses.yml index 8eb7ae457..806cba2b5 100644 --- a/test/fixtures/billing_addresses.yml +++ b/test/fixtures/billing_addresses.yml @@ -3,20 +3,27 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: billing_addresses # # id :integer not null, primary key -# client_id :integer not null -# contact_id :integer -# supplement :string -# street :string -# zip_code :string -# town :string # country :string(2) # invoicing_key :string +# street :string +# supplement :string +# town :string +# zip_code :string +# client_id :integer not null +# contact_id :integer +# +# Indexes +# +# index_billing_addresses_on_client_id (client_id) +# index_billing_addresses_on_contact_id (contact_id) # +# }}} --- swisstopo: diff --git a/test/fixtures/clients.yml b/test/fixtures/clients.yml index 16a29b3e7..5608e4d7d 100644 --- a/test/fixtures/clients.yml +++ b/test/fixtures/clients.yml @@ -4,19 +4,26 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: clients # # id :integer not null, primary key -# work_item_id :integer not null -# crm_key :string # allow_local :boolean default(FALSE), not null -# last_invoice_number :integer default(0) +# crm_key :string +# e_bill_account_key :string # invoicing_key :string +# last_invoice_number :integer default(0) # sector_id :integer -# e_bill_account_key :string +# work_item_id :integer not null +# +# Indexes +# +# index_clients_on_sector_id (sector_id) +# index_clients_on_work_item_id (work_item_id) # +# }}} # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html diff --git a/test/fixtures/contacts.yml b/test/fixtures/contacts.yml index 62a3e1058..45389cdd2 100644 --- a/test/fixtures/contacts.yml +++ b/test/fixtures/contacts.yml @@ -5,23 +5,29 @@ # encoding: utf-8 +# {{{ # == Schema Information # # Table name: contacts # # id :integer not null, primary key -# client_id :integer not null -# lastname :string +# crm_key :string +# email :string # firstname :string # function :string -# email :string -# phone :string +# invoicing_key :string +# lastname :string # mobile :string -# crm_key :string +# phone :string # created_at :datetime # updated_at :datetime -# invoicing_key :string +# client_id :integer not null +# +# Indexes +# +# index_contacts_on_client_id (client_id) # +# }}} --- swisstopo_1: diff --git a/test/fixtures/contracts.yml b/test/fixtures/contracts.yml index 54aa116db..cb4ec3ed5 100644 --- a/test/fixtures/contracts.yml +++ b/test/fixtures/contracts.yml @@ -4,19 +4,21 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: contracts # # id :integer not null, primary key -# number :string not null -# start_date :date not null # end_date :date not null +# notes :text +# number :string not null # payment_period :integer not null # reference :text # sla :text -# notes :text +# start_date :date not null # +# }}} --- puzzletime: diff --git a/test/fixtures/custom_lists.yml b/test/fixtures/custom_lists.yml index f68e225ec..ee9b39865 100644 --- a/test/fixtures/custom_lists.yml +++ b/test/fixtures/custom_lists.yml @@ -4,16 +4,18 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: custom_lists # # id :integer not null, primary key +# item_ids :integer not null, is an Array +# item_type :string not null # name :string not null # employee_id :integer -# item_type :string not null -# item_ids :integer not null, is an Array # +# }}} --- list_a: diff --git a/test/fixtures/departments.yml b/test/fixtures/departments.yml index d5a1460fb..fc23c9237 100644 --- a/test/fixtures/departments.yml +++ b/test/fixtures/departments.yml @@ -4,6 +4,7 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: departments @@ -12,6 +13,12 @@ # name :string(255) not null # shortname :string(3) not null # +# Indexes +# +# index_departments_on_name (name) UNIQUE +# index_departments_on_shortname (shortname) UNIQUE +# +# }}} # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html diff --git a/test/fixtures/employees.yml b/test/fixtures/employees.yml index 53d586f92..51abc32da 100644 --- a/test/fixtures/employees.yml +++ b/test/fixtures/employees.yml @@ -2,41 +2,54 @@ # PuzzleTime and licensed under the Affero General Public License version 3 # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: employees # # id :integer not null, primary key -# firstname :string(255) not null -# lastname :string(255) not null -# shortname :string(3) not null -# passwd :string(255) +# additional_information :text +# birthday :date +# city :string +# committed_worktimes_at :date +# crm_key :string # email :string(255) not null -# management :boolean default(FALSE) +# emergency_contact_name :string +# emergency_contact_phone :string +# encrypted_password :string default("") +# eval_periods :string(3) is an Array +# firstname :string(255) not null +# graduation :string +# identity_card_type :string +# identity_card_valid_until :date # initial_vacation_days :float +# lastname :string(255) not null # ldapname :string(255) -# eval_periods :string(3) is an Array -# department_id :integer -# committed_worktimes_at :date -# probation_period_end_date :date +# management :boolean default(FALSE) +# marital_status :integer +# nationalities :string is an Array # phone_office :string # phone_private :string -# street :string # postal_code :string -# city :string -# birthday :date -# emergency_contact_name :string -# emergency_contact_phone :string -# marital_status :integer -# social_insurance :string -# crm_key :string -# additional_information :text +# probation_period_end_date :date +# remember_created_at :datetime # reviewed_worktimes_at :date -# nationalities :string is an Array -# graduation :string -# identity_card_type :string -# identity_card_valid_until :date +# shortname :string(3) not null +# social_insurance :string +# street :string +# worktimes_commit_reminder :boolean default(TRUE), not null +# created_at :datetime not null +# updated_at :datetime not null +# department_id :integer +# workplace_id :bigint +# +# Indexes +# +# chk_unique_name (shortname) UNIQUE +# index_employees_on_department_id (department_id) +# index_employees_on_workplace_id (workplace_id) # +# }}} # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html diff --git a/test/fixtures/employment_role_categories.yml b/test/fixtures/employment_role_categories.yml index 1d75381ab..ab45b70ce 100644 --- a/test/fixtures/employment_role_categories.yml +++ b/test/fixtures/employment_role_categories.yml @@ -4,6 +4,7 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: employment_role_categories @@ -11,6 +12,11 @@ # id :integer not null, primary key # name :string not null # +# Indexes +# +# index_employment_role_categories_on_name (name) UNIQUE +# +# }}} # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html diff --git a/test/fixtures/employment_role_levels.yml b/test/fixtures/employment_role_levels.yml index 993cd54f3..a89607c27 100644 --- a/test/fixtures/employment_role_levels.yml +++ b/test/fixtures/employment_role_levels.yml @@ -4,6 +4,7 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: employment_role_levels @@ -11,6 +12,11 @@ # id :integer not null, primary key # name :string not null # +# Indexes +# +# index_employment_role_levels_on_name (name) UNIQUE +# +# }}} # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html diff --git a/test/fixtures/employment_roles.yml b/test/fixtures/employment_roles.yml index ebc17fca3..a0f65ad94 100644 --- a/test/fixtures/employment_roles.yml +++ b/test/fixtures/employment_roles.yml @@ -4,16 +4,22 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: employment_roles # # id :integer not null, primary key -# name :string not null # billable :boolean not null # level :boolean not null +# name :string not null # employment_role_category_id :integer # +# Indexes +# +# index_employment_roles_on_name (name) UNIQUE +# +# }}} # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html diff --git a/test/fixtures/employment_roles_employments.yml b/test/fixtures/employment_roles_employments.yml index 29994b60b..181dc274d 100644 --- a/test/fixtures/employment_roles_employments.yml +++ b/test/fixtures/employment_roles_employments.yml @@ -3,16 +3,22 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: employment_roles_employments # # id :integer not null, primary key +# percent :decimal(5, 2) not null # employment_id :integer not null # employment_role_id :integer not null # employment_role_level_id :integer -# percent :decimal(5, 2) not null # +# Indexes +# +# index_unique_employment_employment_role (employment_id,employment_role_id) UNIQUE +# +# }}} # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html diff --git a/test/fixtures/employments.yml b/test/fixtures/employments.yml index 1ae1d061f..128989da2 100644 --- a/test/fixtures/employments.yml +++ b/test/fixtures/employments.yml @@ -4,18 +4,28 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: employments # # id :integer not null, primary key -# employee_id :integer +# comment :string +# end_date :date # percent :decimal(5, 2) not null # start_date :date not null -# end_date :date # vacation_days_per_year :decimal(5, 2) -# comment :string +# employee_id :integer +# +# Indexes +# +# index_employments_on_employee_id (employee_id) +# +# Foreign Keys +# +# fk_employments_employees (employee_id => employees.id) ON DELETE => cascade # +# }}} # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html diff --git a/test/fixtures/expenses.yml b/test/fixtures/expenses.yml index e8906cd5b..785123703 100644 --- a/test/fixtures/expenses.yml +++ b/test/fixtures/expenses.yml @@ -1,21 +1,30 @@ +# {{{ # == Schema Information # # Table name: expenses # -# id :bigint(8) not null, primary key -# employee_id :bigint(8) not null -# kind :integer not null -# status :integer default("pending"), not null +# id :bigint not null, primary key # amount :decimal(12, 2) not null -# payment_date :date not null # description :text not null +# kind :integer not null +# payment_date :date not null # reason :text -# reviewer_id :bigint(8) -# reviewed_at :datetime -# order_id :bigint(8) # reimbursement_date :date +# reviewed_at :datetime +# status :integer default("pending"), not null # submission_date :date +# employee_id :bigint not null +# order_id :bigint +# reviewer_id :bigint +# +# Indexes +# +# index_expenses_on_employee_id (employee_id) +# index_expenses_on_order_id (order_id) +# index_expenses_on_reviewer_id (reviewer_id) +# index_expenses_on_status (status) # +# }}} --- pending: diff --git a/test/fixtures/holidays.yml b/test/fixtures/holidays.yml index 5e9160587..1a48e8026 100644 --- a/test/fixtures/holidays.yml +++ b/test/fixtures/holidays.yml @@ -4,6 +4,7 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: holidays @@ -12,6 +13,11 @@ # holiday_date :date not null # musthours_day :float not null # +# Indexes +# +# index_holidays_on_holiday_date (holiday_date) UNIQUE +# +# }}} --- pfingstmontag: diff --git a/test/fixtures/invoices.yml b/test/fixtures/invoices.yml index d224a4cb4..f7b8ad646 100644 --- a/test/fixtures/invoices.yml +++ b/test/fixtures/invoices.yml @@ -4,26 +4,33 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: invoices # # id :integer not null, primary key -# order_id :integer not null # billing_date :date not null # due_date :date not null -# total_amount :decimal(12, 2) not null -# total_hours :float not null -# reference :string not null +# grouping :integer default("accounting_posts"), not null +# invoicing_key :string # period_from :date not null # period_to :date not null +# reference :string not null # status :string not null -# billing_address_id :integer not null -# invoicing_key :string +# total_amount :decimal(12, 2) not null +# total_hours :float not null # created_at :datetime # updated_at :datetime -# grouping :integer default("accounting_posts"), not null +# billing_address_id :integer not null +# order_id :integer not null +# +# Indexes +# +# index_invoices_on_billing_address_id (billing_address_id) +# index_invoices_on_order_id (order_id) # +# }}} --- webauftritt_may: diff --git a/test/fixtures/market_opportunities.yml b/test/fixtures/market_opportunities.yml new file mode 100644 index 000000000..2c21e13e8 --- /dev/null +++ b/test/fixtures/market_opportunities.yml @@ -0,0 +1,32 @@ +# {{{ +# == Schema Information +# +# Table name: market_opportunities +# +# id :bigint not null, primary key +# active :boolean default(TRUE), not null +# name :string not null +# created_at :datetime not null +# updated_at :datetime not null +# +# Indexes +# +# index_market_opportunities_on_name (name) UNIQUE +# +# }}} + +one: + name: MarketOpportunity1 + active: true + +two: + name: MarketOpportunity2 + active: true + +three: + name: MarketOpportunity3 + active: true + +inactive: + name: InactiveMarketOpportunity + active: false diff --git a/test/fixtures/order_comments.yml b/test/fixtures/order_comments.yml index 64d86cbbd..d4ee25321 100644 --- a/test/fixtures/order_comments.yml +++ b/test/fixtures/order_comments.yml @@ -4,18 +4,24 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: order_comments # # id :integer not null, primary key -# order_id :integer not null # text :text not null -# creator_id :integer -# updater_id :integer # created_at :datetime # updated_at :datetime +# creator_id :integer +# order_id :integer not null +# updater_id :integer +# +# Indexes +# +# index_order_comments_on_order_id (order_id) # +# }}} --- puzzletime_first: diff --git a/test/fixtures/order_kinds.yml b/test/fixtures/order_kinds.yml index bd1119985..558f6ae5e 100644 --- a/test/fixtures/order_kinds.yml +++ b/test/fixtures/order_kinds.yml @@ -4,6 +4,7 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: order_kinds @@ -11,6 +12,11 @@ # id :integer not null, primary key # name :string not null # +# Indexes +# +# index_order_kinds_on_name (name) UNIQUE +# +# }}} --- projekt: diff --git a/test/fixtures/order_statuses.yml b/test/fixtures/order_statuses.yml index 5f94f6ff7..fe927c703 100644 --- a/test/fixtures/order_statuses.yml +++ b/test/fixtures/order_statuses.yml @@ -4,17 +4,24 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: order_statuses # # id :integer not null, primary key -# name :string not null -# style :string # closed :boolean default(FALSE), not null -# position :integer not null # default :boolean default(FALSE), not null +# name :string not null +# position :integer not null +# style :string +# +# Indexes +# +# index_order_statuses_on_name (name) UNIQUE +# index_order_statuses_on_position (position) # +# }}} --- offeriert: diff --git a/test/fixtures/order_targets.yml b/test/fixtures/order_targets.yml index 7fca2ff2c..2556ba46b 100644 --- a/test/fixtures/order_targets.yml +++ b/test/fixtures/order_targets.yml @@ -4,18 +4,25 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: order_targets # # id :integer not null, primary key -# order_id :integer not null -# target_scope_id :integer not null -# rating :string default("green"), not null # comment :text +# rating :string default("green"), not null # created_at :datetime # updated_at :datetime +# order_id :integer not null +# target_scope_id :integer not null +# +# Indexes +# +# index_order_targets_on_order_id (order_id) +# index_order_targets_on_target_scope_id (target_scope_id) # +# }}} --- puzzletime_time: diff --git a/test/fixtures/order_uncertainties.yml b/test/fixtures/order_uncertainties.yml index c008ec55d..ff19ba3cc 100644 --- a/test/fixtures/order_uncertainties.yml +++ b/test/fixtures/order_uncertainties.yml @@ -4,20 +4,30 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: order_uncertainties # # id :integer not null, primary key -# order_id :integer not null -# type :string not null -# name :string not null -# probability :integer default("improbable"), not null # impact :integer default("none"), not null # measure :text +# name :string not null +# probability :integer default("improbable"), not null +# type :string not null # created_at :datetime not null # updated_at :datetime not null +# order_id :integer not null +# +# Indexes +# +# index_order_uncertainties_on_order_id (order_id) +# +# Foreign Keys +# +# fk_rails_... (order_id => orders.id) # +# }}} # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html diff --git a/test/fixtures/orders.yml b/test/fixtures/orders.yml index 7b71a8af0..cec560a3c 100644 --- a/test/fixtures/orders.yml +++ b/test/fixtures/orders.yml @@ -4,27 +4,39 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: orders # # id :integer not null, primary key -# work_item_id :integer not null -# kind_id :integer -# responsible_id :integer -# status_id :integer -# department_id :integer -# contract_id :integer -# billing_address_id :integer +# closed_at :date +# committed_at :date +# completed_at :date # crm_key :string +# major_chance_value :integer +# major_risk_value :integer # created_at :datetime # updated_at :datetime -# completed_at :date -# committed_at :date -# closed_at :date -# major_risk_value :integer -# major_chance_value :integer +# billing_address_id :integer +# contract_id :integer +# department_id :integer +# kind_id :integer +# responsible_id :integer +# status_id :integer +# work_item_id :integer not null +# +# Indexes +# +# index_orders_on_billing_address_id (billing_address_id) +# index_orders_on_contract_id (contract_id) +# index_orders_on_department_id (department_id) +# index_orders_on_kind_id (kind_id) +# index_orders_on_responsible_id (responsible_id) +# index_orders_on_status_id (status_id) +# index_orders_on_work_item_id (work_item_id) # +# }}} --- puzzletime: diff --git a/test/fixtures/overtime_vacations.yml b/test/fixtures/overtime_vacations.yml index b7cb73ca4..b93e0db2f 100644 --- a/test/fixtures/overtime_vacations.yml +++ b/test/fixtures/overtime_vacations.yml @@ -4,15 +4,21 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: overtime_vacations # # id :integer not null, primary key # hours :float not null -# employee_id :integer not null # transfer_date :date not null +# employee_id :integer not null +# +# Indexes +# +# index_overtime_vacations_on_employee_id (employee_id) # +# }}} --- pascal_1: diff --git a/test/fixtures/plannings.yml b/test/fixtures/plannings.yml index 9cce14972..1f222da54 100644 --- a/test/fixtures/plannings.yml +++ b/test/fixtures/plannings.yml @@ -4,17 +4,25 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: plannings # # id :integer not null, primary key -# employee_id :integer not null -# work_item_id :integer not null # date :date not null -# percent :integer not null # definitive :boolean default(FALSE), not null +# percent :integer not null +# employee_id :integer not null +# work_item_id :integer not null +# +# Indexes +# +# index_plannings_on_employee_id (employee_id) +# index_plannings_on_employee_id_and_work_item_id_and_date (employee_id,work_item_id,date) UNIQUE +# index_plannings_on_work_item_id (work_item_id) # +# }}} --- hitobito_demo_app_planning1: diff --git a/test/fixtures/portfolio_items.yml b/test/fixtures/portfolio_items.yml index 56953a4d8..469eea8b5 100644 --- a/test/fixtures/portfolio_items.yml +++ b/test/fixtures/portfolio_items.yml @@ -4,14 +4,20 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: portfolio_items # # id :integer not null, primary key -# name :string not null # active :boolean default(TRUE), not null +# name :string not null +# +# Indexes +# +# index_portfolio_items_on_name (name) UNIQUE # +# }}} --- web: diff --git a/test/fixtures/sectors.yml b/test/fixtures/sectors.yml index 6f266f83d..940f145ed 100644 --- a/test/fixtures/sectors.yml +++ b/test/fixtures/sectors.yml @@ -4,14 +4,16 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: sectors # # id :integer not null, primary key -# name :string not null # active :boolean default(TRUE), not null +# name :string not null # +# }}} --- verwaltung: diff --git a/test/fixtures/services.yml b/test/fixtures/services.yml index a2dcb4b9d..fb94387bb 100644 --- a/test/fixtures/services.yml +++ b/test/fixtures/services.yml @@ -4,14 +4,16 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: services # # id :integer not null, primary key -# name :string not null # active :boolean default(TRUE), not null +# name :string not null # +# }}} --- software: diff --git a/test/fixtures/target_scopes.yml b/test/fixtures/target_scopes.yml index 0ea0fcf3b..3f8a5ce57 100644 --- a/test/fixtures/target_scopes.yml +++ b/test/fixtures/target_scopes.yml @@ -4,18 +4,25 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: target_scopes # # id :integer not null, primary key -# name :string not null # icon :string +# name :string not null # position :integer not null # rating_green_description :string # rating_orange_description :string # rating_red_description :string # +# Indexes +# +# index_target_scopes_on_name (name) UNIQUE +# index_target_scopes_on_position (position) +# +# }}} --- time: diff --git a/test/fixtures/user_notifications.yml b/test/fixtures/user_notifications.yml index 266741f36..f6abb9a0e 100644 --- a/test/fixtures/user_notifications.yml +++ b/test/fixtures/user_notifications.yml @@ -4,6 +4,7 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: user_notifications @@ -13,6 +14,11 @@ # date_to :date # message :text not null # +# Indexes +# +# index_user_notifications_on_date_from_and_date_to (date_from,date_to) +# +# }}} --- hello: diff --git a/test/fixtures/work_items.yml b/test/fixtures/work_items.yml index 9a19e222d..dd99d7bce 100644 --- a/test/fixtures/work_items.yml +++ b/test/fixtures/work_items.yml @@ -4,21 +4,28 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: work_items # # id :integer not null, primary key -# parent_id :integer -# name :string not null -# shortname :string(5) not null +# closed :boolean default(FALSE), not null # description :text +# leaf :boolean default(TRUE), not null +# name :string not null # path_ids :integer is an Array -# path_shortnames :string # path_names :string(2047) -# leaf :boolean default(TRUE), not null -# closed :boolean default(FALSE), not null +# path_shortnames :string +# shortname :string(5) not null +# parent_id :integer +# +# Indexes +# +# index_work_items_on_parent_id (parent_id) +# index_work_items_on_path_ids (path_ids) # +# }}} --- puzzle: diff --git a/test/fixtures/working_conditions.yml b/test/fixtures/working_conditions.yml index ddb1f3f2b..3847972da 100644 --- a/test/fixtures/working_conditions.yml +++ b/test/fixtures/working_conditions.yml @@ -4,15 +4,17 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: working_conditions # # id :integer not null, primary key -# valid_from :date -# vacation_days_per_year :decimal(5, 2) not null # must_hours_per_day :decimal(4, 2) not null +# vacation_days_per_year :decimal(5, 2) not null +# valid_from :date # +# }}} --- default: diff --git a/test/fixtures/workplaces.yml b/test/fixtures/workplaces.yml index 5f24aee6c..ff3d5527a 100644 --- a/test/fixtures/workplaces.yml +++ b/test/fixtures/workplaces.yml @@ -1,7 +1,12 @@ -# Copyright (c) 2006-2022, Puzzle ITC GmbH. This file is part of -# PuzzleTime and licensed under the Affero General Public License version 3 -# or later. See the COPYING file at the top-level directory or at -# https://github.com/puzzle/puzzletime. +# {{{ +# == Schema Information +# +# Table name: workplaces +# +# id :bigint not null, primary key +# name :string +# +# }}} --- bern: diff --git a/test/fixtures/worktimes.yml b/test/fixtures/worktimes.yml index 83d3f8f89..14b64cfd1 100644 --- a/test/fixtures/worktimes.yml +++ b/test/fixtures/worktimes.yml @@ -4,25 +4,41 @@ # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: worktimes # -# id :integer not null, primary key -# absence_id :integer -# employee_id :integer -# report_type :string(255) not null -# work_date :date not null -# hours :float -# from_start_time :time -# to_end_time :time -# description :text -# billable :boolean default(TRUE) -# type :string(255) -# ticket :string(255) -# work_item_id :integer -# invoice_id :integer +# id :integer not null, primary key +# billable :boolean default(TRUE) +# description :text +# from_start_time :time +# hours :float +# internal_description :text +# meal_compensation :boolean default(FALSE), not null +# report_type :string(255) not null +# ticket :string(255) +# to_end_time :time +# type :string(255) +# work_date :date not null +# absence_id :integer +# employee_id :integer +# invoice_id :integer +# work_item_id :integer # +# Indexes +# +# index_worktimes_on_invoice_id (invoice_id) +# worktimes_absences (absence_id,employee_id,work_date) +# worktimes_employees (employee_id,work_date) +# worktimes_work_items (work_item_id,employee_id,work_date) +# +# Foreign Keys +# +# fk_times_absences (absence_id => absences.id) ON DELETE => cascade +# fk_times_employees (employee_id => employees.id) ON DELETE => cascade +# +# }}} # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html diff --git a/test/models/accounting_post_test.rb b/test/models/accounting_post_test.rb index 2ef603868..5cedc3e2d 100644 --- a/test/models/accounting_post_test.rb +++ b/test/models/accounting_post_test.rb @@ -5,24 +5,35 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: accounting_posts # # id :integer not null, primary key -# work_item_id :integer not null -# portfolio_item_id :integer +# billable :boolean default(TRUE), not null +# closed :boolean default(FALSE), not null +# description_required :boolean default(FALSE), not null +# from_to_times_required :boolean default(FALSE), not null +# meal_compensation :boolean default(FALSE), not null # offered_hours :float # offered_rate :decimal(12, 2) # offered_total :decimal(12, 2) # remaining_hours :integer -# billable :boolean default(TRUE), not null -# description_required :boolean default(FALSE), not null # ticket_required :boolean default(FALSE), not null -# closed :boolean default(FALSE), not null -# from_to_times_required :boolean default(FALSE), not null +# market_opportunity_id :integer +# portfolio_item_id :integer # service_id :integer +# work_item_id :integer not null +# +# Indexes +# +# index_accounting_posts_on_market_opportunity_id (market_opportunity_id) +# index_accounting_posts_on_portfolio_item_id (portfolio_item_id) +# index_accounting_posts_on_service_id (service_id) +# index_accounting_posts_on_work_item_id (work_item_id) # +# }}} require 'test_helper' diff --git a/test/models/additional_crm_order_test.rb b/test/models/additional_crm_order_test.rb index d3e8574a5..eff86306d 100644 --- a/test/models/additional_crm_order_test.rb +++ b/test/models/additional_crm_order_test.rb @@ -1,14 +1,20 @@ # frozen_string_literal: true +# {{{ # == Schema Information # # Table name: additional_crm_orders # -# id :bigint(8) not null, primary key -# order_id :bigint(8) not null +# id :bigint not null, primary key # crm_key :string not null # name :string +# order_id :bigint not null # +# Indexes +# +# index_additional_crm_orders_on_order_id (order_id) +# +# }}} require 'test_helper' diff --git a/test/models/authentication_test.rb b/test/models/authentication_test.rb index 6a0eb7772..42734269b 100644 --- a/test/models/authentication_test.rb +++ b/test/models/authentication_test.rb @@ -1,5 +1,24 @@ # frozen_string_literal: true +# {{{ +# == Schema Information +# +# Table name: authentications +# +# id :bigint not null, primary key +# provider :string +# token :string +# token_secret :string +# uid :string +# created_at :datetime not null +# updated_at :datetime not null +# employee_id :bigint +# +# Indexes +# +# index_authentications_on_employee_id (employee_id) +# +# }}} require 'test_helper' class AuthenticationTest < ActiveSupport::TestCase diff --git a/test/models/client_test.rb b/test/models/client_test.rb index 4725a5c5b..dadb50948 100644 --- a/test/models/client_test.rb +++ b/test/models/client_test.rb @@ -5,19 +5,26 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: clients # # id :integer not null, primary key -# work_item_id :integer not null -# crm_key :string # allow_local :boolean default(FALSE), not null -# last_invoice_number :integer default(0) +# crm_key :string +# e_bill_account_key :string # invoicing_key :string +# last_invoice_number :integer default(0) # sector_id :integer -# e_bill_account_key :string +# work_item_id :integer not null +# +# Indexes +# +# index_clients_on_sector_id (sector_id) +# index_clients_on_work_item_id (work_item_id) # +# }}} require 'test_helper' diff --git a/test/models/contact_test.rb b/test/models/contact_test.rb index 812dd85e7..8f0a8a9fa 100644 --- a/test/models/contact_test.rb +++ b/test/models/contact_test.rb @@ -1,9 +1,28 @@ # frozen_string_literal: true -# Copyright (c) 2006-2022, Puzzle ITC GmbH. This file is part of -# PuzzleTime and licensed under the Affero General Public License version 3 -# or later. See the COPYING file at the top-level directory or at -# https://github.com/puzzle/puzzletime. +# {{{ +# == Schema Information +# +# Table name: contacts +# +# id :integer not null, primary key +# crm_key :string +# email :string +# firstname :string +# function :string +# invoicing_key :string +# lastname :string +# mobile :string +# phone :string +# created_at :datetime +# updated_at :datetime +# client_id :integer not null +# +# Indexes +# +# index_contacts_on_client_id (client_id) +# +# }}} require 'test_helper' diff --git a/test/models/employee_test.rb b/test/models/employee_test.rb index c0841397a..6b4194a3a 100644 --- a/test/models/employee_test.rb +++ b/test/models/employee_test.rb @@ -2,41 +2,54 @@ # PuzzleTime and licensed under the Affero General Public License version 3 # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: employees # # id :integer not null, primary key -# firstname :string(255) not null -# lastname :string(255) not null -# shortname :string(3) not null -# passwd :string(255) +# additional_information :text +# birthday :date +# city :string +# committed_worktimes_at :date +# crm_key :string # email :string(255) not null -# management :boolean default(FALSE) +# emergency_contact_name :string +# emergency_contact_phone :string +# encrypted_password :string default("") +# eval_periods :string(3) is an Array +# firstname :string(255) not null +# graduation :string +# identity_card_type :string +# identity_card_valid_until :date # initial_vacation_days :float +# lastname :string(255) not null # ldapname :string(255) -# eval_periods :string(3) is an Array -# department_id :integer -# committed_worktimes_at :date -# probation_period_end_date :date +# management :boolean default(FALSE) +# marital_status :integer +# nationalities :string is an Array # phone_office :string # phone_private :string -# street :string # postal_code :string -# city :string -# birthday :date -# emergency_contact_name :string -# emergency_contact_phone :string -# marital_status :integer -# social_insurance :string -# crm_key :string -# additional_information :text +# probation_period_end_date :date +# remember_created_at :datetime # reviewed_worktimes_at :date -# nationalities :string is an Array -# graduation :string -# identity_card_type :string -# identity_card_valid_until :date +# shortname :string(3) not null +# social_insurance :string +# street :string +# worktimes_commit_reminder :boolean default(TRUE), not null +# created_at :datetime not null +# updated_at :datetime not null +# department_id :integer +# workplace_id :bigint +# +# Indexes +# +# chk_unique_name (shortname) UNIQUE +# index_employees_on_department_id (department_id) +# index_employees_on_workplace_id (workplace_id) # +# }}} require 'test_helper' diff --git a/test/models/employment_role_category_test.rb b/test/models/employment_role_category_test.rb index 7224c2b50..824a44f66 100644 --- a/test/models/employment_role_category_test.rb +++ b/test/models/employment_role_category_test.rb @@ -5,6 +5,7 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: employment_role_categories @@ -12,6 +13,11 @@ # id :integer not null, primary key # name :string not null # +# Indexes +# +# index_employment_role_categories_on_name (name) UNIQUE +# +# }}} require 'test_helper' diff --git a/test/models/employment_role_level_test.rb b/test/models/employment_role_level_test.rb index 8c8d4259f..e5c947b23 100644 --- a/test/models/employment_role_level_test.rb +++ b/test/models/employment_role_level_test.rb @@ -5,6 +5,7 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: employment_role_levels @@ -12,6 +13,11 @@ # id :integer not null, primary key # name :string not null # +# Indexes +# +# index_employment_role_levels_on_name (name) UNIQUE +# +# }}} require 'test_helper' diff --git a/test/models/employment_role_test.rb b/test/models/employment_role_test.rb index fa5ecdeda..194bd7f7b 100644 --- a/test/models/employment_role_test.rb +++ b/test/models/employment_role_test.rb @@ -5,16 +5,22 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: employment_roles # # id :integer not null, primary key -# name :string not null # billable :boolean not null # level :boolean not null +# name :string not null # employment_role_category_id :integer # +# Indexes +# +# index_employment_roles_on_name (name) UNIQUE +# +# }}} require 'test_helper' diff --git a/test/models/employment_roles_employment_test.rb b/test/models/employment_roles_employment_test.rb index 64e34cfa8..2d3045bf1 100644 --- a/test/models/employment_roles_employment_test.rb +++ b/test/models/employment_roles_employment_test.rb @@ -5,16 +5,22 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: employment_roles_employments # # id :integer not null, primary key +# percent :decimal(5, 2) not null # employment_id :integer not null # employment_role_id :integer not null # employment_role_level_id :integer -# percent :decimal(5, 2) not null # +# Indexes +# +# index_unique_employment_employment_role (employment_id,employment_role_id) UNIQUE +# +# }}} require 'test_helper' diff --git a/test/models/employment_test.rb b/test/models/employment_test.rb index 737359370..b3665a696 100644 --- a/test/models/employment_test.rb +++ b/test/models/employment_test.rb @@ -5,18 +5,28 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: employments # # id :integer not null, primary key -# employee_id :integer +# comment :string +# end_date :date # percent :decimal(5, 2) not null # start_date :date not null -# end_date :date # vacation_days_per_year :decimal(5, 2) -# comment :string +# employee_id :integer +# +# Indexes +# +# index_employments_on_employee_id (employee_id) +# +# Foreign Keys +# +# fk_employments_employees (employee_id => employees.id) ON DELETE => cascade # +# }}} require 'test_helper' diff --git a/test/models/expense_test.rb b/test/models/expense_test.rb index d89f174e3..4e4677628 100644 --- a/test/models/expense_test.rb +++ b/test/models/expense_test.rb @@ -1,23 +1,32 @@ # frozen_string_literal: true +# {{{ # == Schema Information # # Table name: expenses # -# id :bigint(8) not null, primary key -# employee_id :bigint(8) not null -# kind :integer not null -# status :integer default("pending"), not null +# id :bigint not null, primary key # amount :decimal(12, 2) not null -# payment_date :date not null # description :text not null +# kind :integer not null +# payment_date :date not null # reason :text -# reviewer_id :bigint(8) -# reviewed_at :datetime -# order_id :bigint(8) # reimbursement_date :date +# reviewed_at :datetime +# status :integer default("pending"), not null # submission_date :date +# employee_id :bigint not null +# order_id :bigint +# reviewer_id :bigint +# +# Indexes +# +# index_expenses_on_employee_id (employee_id) +# index_expenses_on_order_id (order_id) +# index_expenses_on_reviewer_id (reviewer_id) +# index_expenses_on_status (status) # +# }}} require 'test_helper' diff --git a/test/models/invoice_test.rb b/test/models/invoice_test.rb index 21ab6cb83..0c95a4071 100644 --- a/test/models/invoice_test.rb +++ b/test/models/invoice_test.rb @@ -5,26 +5,33 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: invoices # # id :integer not null, primary key -# order_id :integer not null # billing_date :date not null # due_date :date not null -# total_amount :decimal(12, 2) not null -# total_hours :float not null -# reference :string not null +# grouping :integer default("accounting_posts"), not null +# invoicing_key :string # period_from :date not null # period_to :date not null +# reference :string not null # status :string not null -# billing_address_id :integer not null -# invoicing_key :string +# total_amount :decimal(12, 2) not null +# total_hours :float not null # created_at :datetime # updated_at :datetime -# grouping :integer default("accounting_posts"), not null +# billing_address_id :integer not null +# order_id :integer not null +# +# Indexes +# +# index_invoices_on_billing_address_id (billing_address_id) +# index_invoices_on_order_id (order_id) # +# }}} require 'test_helper' diff --git a/test/models/market_opportunity_test.rb b/test/models/market_opportunity_test.rb new file mode 100644 index 000000000..c82905605 --- /dev/null +++ b/test/models/market_opportunity_test.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +# {{{ +# == Schema Information +# +# Table name: market_opportunities +# +# id :bigint not null, primary key +# active :boolean default(TRUE), not null +# name :string not null +# created_at :datetime not null +# updated_at :datetime not null +# +# Indexes +# +# index_market_opportunities_on_name (name) UNIQUE +# +# }}} +require 'test_helper' + +class MarketOpportunityTest < ActiveSupport::TestCase + test 'Being used prevents deletion of a market opportunity' do + MarketOpportunity.create!(name: 'Testopportunity', active: true) + + duplicate = MarketOpportunity.create(name: 'Testopportunity', active: false) + + assert_not duplicate.valid? + end +end diff --git a/test/models/order_contact_test.rb b/test/models/order_contact_test.rb index af7e840b2..7dff6766c 100644 --- a/test/models/order_contact_test.rb +++ b/test/models/order_contact_test.rb @@ -5,15 +5,21 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: order_contacts # -# false :integer not null, primary key +# comment :string # contact_id :integer not null # order_id :integer not null -# comment :string # +# Indexes +# +# index_order_contacts_on_contact_id (contact_id) +# index_order_contacts_on_order_id (order_id) +# +# }}} require 'test_helper' diff --git a/test/models/order_status_test.rb b/test/models/order_status_test.rb index 68c36ff21..22d7517f6 100644 --- a/test/models/order_status_test.rb +++ b/test/models/order_status_test.rb @@ -5,17 +5,24 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: order_statuses # # id :integer not null, primary key -# name :string not null -# style :string # closed :boolean default(FALSE), not null -# position :integer not null # default :boolean default(FALSE), not null +# name :string not null +# position :integer not null +# style :string +# +# Indexes +# +# index_order_statuses_on_name (name) UNIQUE +# index_order_statuses_on_position (position) # +# }}} require 'test_helper' diff --git a/test/models/order_test.rb b/test/models/order_test.rb index 6f47176ea..c39e97174 100644 --- a/test/models/order_test.rb +++ b/test/models/order_test.rb @@ -5,27 +5,39 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: orders # # id :integer not null, primary key -# work_item_id :integer not null -# kind_id :integer -# responsible_id :integer -# status_id :integer -# department_id :integer -# contract_id :integer -# billing_address_id :integer +# closed_at :date +# committed_at :date +# completed_at :date # crm_key :string +# major_chance_value :integer +# major_risk_value :integer # created_at :datetime # updated_at :datetime -# completed_at :date -# committed_at :date -# closed_at :date -# major_risk_value :integer -# major_chance_value :integer +# billing_address_id :integer +# contract_id :integer +# department_id :integer +# kind_id :integer +# responsible_id :integer +# status_id :integer +# work_item_id :integer not null +# +# Indexes +# +# index_orders_on_billing_address_id (billing_address_id) +# index_orders_on_contract_id (contract_id) +# index_orders_on_department_id (department_id) +# index_orders_on_kind_id (kind_id) +# index_orders_on_responsible_id (responsible_id) +# index_orders_on_status_id (status_id) +# index_orders_on_work_item_id (work_item_id) # +# }}} require 'test_helper' diff --git a/test/models/order_uncertainty_test.rb b/test/models/order_uncertainty_test.rb index 975e95510..54e393305 100644 --- a/test/models/order_uncertainty_test.rb +++ b/test/models/order_uncertainty_test.rb @@ -5,20 +5,30 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: order_uncertainties # # id :integer not null, primary key -# order_id :integer not null -# type :string not null -# name :string not null -# probability :integer default("improbable"), not null # impact :integer default("none"), not null # measure :text +# name :string not null +# probability :integer default("improbable"), not null +# type :string not null # created_at :datetime not null # updated_at :datetime not null +# order_id :integer not null +# +# Indexes +# +# index_order_uncertainties_on_order_id (order_id) +# +# Foreign Keys +# +# fk_rails_... (order_id => orders.id) # +# }}} require 'test_helper' diff --git a/test/models/ordertime_test.rb b/test/models/ordertime_test.rb index b6a19b89e..eaa98ccc5 100644 --- a/test/models/ordertime_test.rb +++ b/test/models/ordertime_test.rb @@ -5,25 +5,41 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: worktimes # -# id :integer not null, primary key -# absence_id :integer -# employee_id :integer -# report_type :string(255) not null -# work_date :date not null -# hours :float -# from_start_time :time -# to_end_time :time -# description :text -# billable :boolean default(TRUE) -# type :string(255) -# ticket :string(255) -# work_item_id :integer -# invoice_id :integer +# id :integer not null, primary key +# billable :boolean default(TRUE) +# description :text +# from_start_time :time +# hours :float +# internal_description :text +# meal_compensation :boolean default(FALSE), not null +# report_type :string(255) not null +# ticket :string(255) +# to_end_time :time +# type :string(255) +# work_date :date not null +# absence_id :integer +# employee_id :integer +# invoice_id :integer +# work_item_id :integer # +# Indexes +# +# index_worktimes_on_invoice_id (invoice_id) +# worktimes_absences (absence_id,employee_id,work_date) +# worktimes_employees (employee_id,work_date) +# worktimes_work_items (work_item_id,employee_id,work_date) +# +# Foreign Keys +# +# fk_times_absences (absence_id => absences.id) ON DELETE => cascade +# fk_times_employees (employee_id => employees.id) ON DELETE => cascade +# +# }}} require 'test_helper' diff --git a/test/models/planning_test.rb b/test/models/planning_test.rb index ac6c7e5db..3fbbfd46a 100644 --- a/test/models/planning_test.rb +++ b/test/models/planning_test.rb @@ -5,17 +5,25 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: plannings # # id :integer not null, primary key -# employee_id :integer not null -# work_item_id :integer not null # date :date not null -# percent :integer not null # definitive :boolean default(FALSE), not null +# percent :integer not null +# employee_id :integer not null +# work_item_id :integer not null +# +# Indexes +# +# index_plannings_on_employee_id (employee_id) +# index_plannings_on_employee_id_and_work_item_id_and_date (employee_id,work_item_id,date) UNIQUE +# index_plannings_on_work_item_id (work_item_id) # +# }}} require 'test_helper' diff --git a/test/models/user_notification_test.rb b/test/models/user_notification_test.rb index 8f9c2d7df..1db9f91de 100644 --- a/test/models/user_notification_test.rb +++ b/test/models/user_notification_test.rb @@ -5,6 +5,7 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: user_notifications @@ -14,6 +15,11 @@ # date_to :date # message :text not null # +# Indexes +# +# index_user_notifications_on_date_from_and_date_to (date_from,date_to) +# +# }}} require 'test_helper' diff --git a/test/models/work_item_test.rb b/test/models/work_item_test.rb index 865a58ce1..92bd67b31 100644 --- a/test/models/work_item_test.rb +++ b/test/models/work_item_test.rb @@ -5,21 +5,28 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: work_items # # id :integer not null, primary key -# parent_id :integer -# name :string not null -# shortname :string(5) not null +# closed :boolean default(FALSE), not null # description :text +# leaf :boolean default(TRUE), not null +# name :string not null # path_ids :integer is an Array -# path_shortnames :string # path_names :string(2047) -# leaf :boolean default(TRUE), not null -# closed :boolean default(FALSE), not null +# path_shortnames :string +# shortname :string(5) not null +# parent_id :integer +# +# Indexes +# +# index_work_items_on_parent_id (parent_id) +# index_work_items_on_path_ids (path_ids) # +# }}} require 'test_helper' diff --git a/test/models/working_condition_test.rb b/test/models/working_condition_test.rb index 2c1e6cb1f..1d93341fa 100644 --- a/test/models/working_condition_test.rb +++ b/test/models/working_condition_test.rb @@ -5,15 +5,17 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: working_conditions # # id :integer not null, primary key -# valid_from :date -# vacation_days_per_year :decimal(5, 2) not null # must_hours_per_day :decimal(4, 2) not null +# vacation_days_per_year :decimal(5, 2) not null +# valid_from :date # +# }}} require 'test_helper' diff --git a/test/models/workplace_test.rb b/test/models/workplace_test.rb index 1dfb5dc11..eb69a9b6f 100644 --- a/test/models/workplace_test.rb +++ b/test/models/workplace_test.rb @@ -5,13 +5,15 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # -# Table name: workplace +# Table name: workplaces # -# id :integer not null, primary key -# name :string not null +# id :bigint not null, primary key +# name :string # +# }}} require 'test_helper' diff --git a/test/models/worktime_test.rb b/test/models/worktime_test.rb index f2ac28154..0db04f72d 100644 --- a/test/models/worktime_test.rb +++ b/test/models/worktime_test.rb @@ -5,25 +5,41 @@ # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. +# {{{ # == Schema Information # # Table name: worktimes # -# id :integer not null, primary key -# absence_id :integer -# employee_id :integer -# report_type :string(255) not null -# work_date :date not null -# hours :float -# from_start_time :time -# to_end_time :time -# description :text -# billable :boolean default(TRUE) -# type :string(255) -# ticket :string(255) -# work_item_id :integer -# invoice_id :integer +# id :integer not null, primary key +# billable :boolean default(TRUE) +# description :text +# from_start_time :time +# hours :float +# internal_description :text +# meal_compensation :boolean default(FALSE), not null +# report_type :string(255) not null +# ticket :string(255) +# to_end_time :time +# type :string(255) +# work_date :date not null +# absence_id :integer +# employee_id :integer +# invoice_id :integer +# work_item_id :integer # +# Indexes +# +# index_worktimes_on_invoice_id (invoice_id) +# worktimes_absences (absence_id,employee_id,work_date) +# worktimes_employees (employee_id,work_date) +# worktimes_work_items (work_item_id,employee_id,work_date) +# +# Foreign Keys +# +# fk_times_absences (absence_id => absences.id) ON DELETE => cascade +# fk_times_employees (employee_id => employees.id) ON DELETE => cascade +# +# }}} require 'test_helper'