Added duration to tasks. Annotated all models.
This commit is contained in:
parent
face58ebef
commit
dcd2a514a6
30 changed files with 494 additions and 431 deletions
|
|
@ -1,13 +1,3 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: assignments
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# user_id :integer default(0), not null
|
||||
# task_id :integer default(0), not null
|
||||
# accepted :boolean
|
||||
#
|
||||
|
||||
class Assignment < ActiveRecord::Base
|
||||
|
||||
belongs_to :user
|
||||
|
|
@ -23,3 +13,14 @@ class Assignment < ActiveRecord::Base
|
|||
self.task.update_attribute(:assigned, false) if self.task.assignments.empty?
|
||||
end
|
||||
end
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: assignments
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# user_id :integer default(0), not null
|
||||
# task_id :integer default(0), not null
|
||||
# accepted :boolean default(FALSE)
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,3 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: deliveries
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# supplier_id :integer
|
||||
# delivered_on :date
|
||||
# created_at :datetime
|
||||
#
|
||||
|
||||
class Delivery < ActiveRecord::Base
|
||||
|
||||
belongs_to :supplier
|
||||
|
|
@ -27,3 +17,15 @@ class Delivery < ActiveRecord::Base
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: deliveries
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# supplier_id :integer
|
||||
# delivered_on :date
|
||||
# created_at :datetime
|
||||
# note :text
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -1,30 +1,3 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: groups
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# type :string(255) default(""), not null
|
||||
# name :string(255) default(""), not null
|
||||
# description :string(255)
|
||||
# account_balance :decimal(, ) default(0.0), not null
|
||||
# account_updated :datetime
|
||||
# created_on :datetime not null
|
||||
# role_admin :boolean not null
|
||||
# role_suppliers :boolean not null
|
||||
# role_article_meta :boolean not null
|
||||
# role_finance :boolean not null
|
||||
# role_orders :boolean not null
|
||||
# weekly_task :boolean
|
||||
# weekday :integer
|
||||
# task_name :string(255)
|
||||
# task_description :string(255)
|
||||
# task_required_users :integer default(1)
|
||||
# deleted_at :datetime
|
||||
# contact_person :string(255)
|
||||
# contact_phone :string(255)
|
||||
# contact_address :string(255)
|
||||
#
|
||||
|
||||
# Groups organize the User.
|
||||
# A Member gets the roles from the Group
|
||||
class Group < ActiveRecord::Base
|
||||
|
|
@ -67,3 +40,32 @@ class Group < ActiveRecord::Base
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: groups
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# type :string(255) default(""), not null
|
||||
# name :string(255) default(""), not null
|
||||
# description :string(255)
|
||||
# account_balance :decimal(8, 2) default(0.0), not null
|
||||
# account_updated :datetime
|
||||
# created_on :datetime not null
|
||||
# role_admin :boolean default(FALSE), not null
|
||||
# role_suppliers :boolean default(FALSE), not null
|
||||
# role_article_meta :boolean default(FALSE), not null
|
||||
# role_finance :boolean default(FALSE), not null
|
||||
# role_orders :boolean default(FALSE), not null
|
||||
# weekly_task :boolean default(FALSE)
|
||||
# weekday :integer
|
||||
# task_name :string(255)
|
||||
# task_description :string(255)
|
||||
# task_required_users :integer default(1)
|
||||
# deleted_at :datetime
|
||||
# contact_person :string(255)
|
||||
# contact_phone :string(255)
|
||||
# contact_address :string(255)
|
||||
# stats :text
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,3 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: group_order_articles
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# group_order_id :integer default(0), not null
|
||||
# order_article_id :integer default(0), not null
|
||||
# quantity :integer default(0), not null
|
||||
# tolerance :integer default(0), not null
|
||||
# updated_on :datetime not null
|
||||
# result :decimal(, )
|
||||
#
|
||||
|
||||
# A GroupOrderArticle stores the sum of how many items of an OrderArticle are ordered as part of a GroupOrder.
|
||||
# The chronologically order of the Ordergroup - activity are stored in GroupOrderArticleQuantity
|
||||
#
|
||||
|
|
@ -171,3 +158,17 @@ class GroupOrderArticle < ActiveRecord::Base
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: group_order_articles
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# group_order_id :integer default(0), not null
|
||||
# order_article_id :integer default(0), not null
|
||||
# quantity :integer default(0), not null
|
||||
# tolerance :integer default(0), not null
|
||||
# updated_on :datetime not null
|
||||
# result :decimal(8, 3)
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -1,22 +1,3 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: invoices
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# supplier_id :integer
|
||||
# delivery_id :integer
|
||||
# number :string(255)
|
||||
# date :date
|
||||
# paid_on :date
|
||||
# note :text
|
||||
# amount :decimal(8, 2) default(0.0), not null
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# order_id :integer
|
||||
# deposit :decimal(8, 2) default(0.0), not null
|
||||
# deposit_credit :decimal(8, 2) default(0.0), not null
|
||||
#
|
||||
|
||||
class Invoice < ActiveRecord::Base
|
||||
|
||||
belongs_to :supplier
|
||||
|
|
@ -47,3 +28,23 @@ class Invoice < ActiveRecord::Base
|
|||
amount - deposit + deposit_credit
|
||||
end
|
||||
end
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: invoices
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# supplier_id :integer
|
||||
# delivery_id :integer
|
||||
# order_id :integer
|
||||
# number :string(255)
|
||||
# date :date
|
||||
# paid_on :date
|
||||
# note :text
|
||||
# amount :decimal(8, 2) default(0.0), not null
|
||||
# deposit :decimal(8, 2) default(0.0), not null
|
||||
# deposit_credit :decimal(8, 2) default(0.0), not null
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,3 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: messages
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# sender_id :integer
|
||||
# recipients_ids :text
|
||||
# subject :string(255) not null
|
||||
# body :text
|
||||
# email_state :integer default(0), not null
|
||||
# private :boolean
|
||||
# created_at :datetime
|
||||
#
|
||||
|
||||
class Message < ActiveRecord::Base
|
||||
belongs_to :sender, :class_name => "User", :foreign_key => "sender_id"
|
||||
|
||||
|
|
@ -89,3 +75,18 @@ class Message < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: messages
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# sender_id :integer
|
||||
# recipients_ids :text
|
||||
# subject :string(255) not null
|
||||
# body :text
|
||||
# email_state :integer default(0), not null
|
||||
# private :boolean default(FALSE)
|
||||
# created_at :datetime
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -1,30 +1,3 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: groups
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# type :string(255) default(""), not null
|
||||
# name :string(255) default(""), not null
|
||||
# description :string(255)
|
||||
# account_balance :decimal(, ) default(0.0), not null
|
||||
# account_updated :datetime
|
||||
# created_on :datetime not null
|
||||
# role_admin :boolean not null
|
||||
# role_suppliers :boolean not null
|
||||
# role_article_meta :boolean not null
|
||||
# role_finance :boolean not null
|
||||
# role_orders :boolean not null
|
||||
# weekly_task :boolean
|
||||
# weekday :integer
|
||||
# task_name :string(255)
|
||||
# task_description :string(255)
|
||||
# task_required_users :integer default(1)
|
||||
# deleted_at :datetime
|
||||
# contact_person :string(255)
|
||||
# contact_phone :string(255)
|
||||
# contact_address :string(255)
|
||||
#
|
||||
|
||||
# Ordergroups can order, they are "children" of the class Group
|
||||
#
|
||||
# Ordergroup have the following attributes, in addition to Group
|
||||
|
|
@ -109,3 +82,32 @@ class Ordergroup < Group
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: groups
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# type :string(255) default(""), not null
|
||||
# name :string(255) default(""), not null
|
||||
# description :string(255)
|
||||
# account_balance :decimal(8, 2) default(0.0), not null
|
||||
# account_updated :datetime
|
||||
# created_on :datetime not null
|
||||
# role_admin :boolean default(FALSE), not null
|
||||
# role_suppliers :boolean default(FALSE), not null
|
||||
# role_article_meta :boolean default(FALSE), not null
|
||||
# role_finance :boolean default(FALSE), not null
|
||||
# role_orders :boolean default(FALSE), not null
|
||||
# weekly_task :boolean default(FALSE)
|
||||
# weekday :integer
|
||||
# task_name :string(255)
|
||||
# task_description :string(255)
|
||||
# task_required_users :integer default(1)
|
||||
# deleted_at :datetime
|
||||
# contact_person :string(255)
|
||||
# contact_phone :string(255)
|
||||
# contact_address :string(255)
|
||||
# stats :text
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,3 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: pages
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# title :string(255)
|
||||
# body :text
|
||||
# permalink :string(255)
|
||||
# lock_version :integer default(0)
|
||||
# updated_by :integer
|
||||
# redirect :integer
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
#
|
||||
|
||||
class Page < ActiveRecord::Base
|
||||
|
||||
belongs_to :user, :foreign_key => 'updated_by'
|
||||
|
|
@ -66,3 +51,20 @@ class Page < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: pages
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# title :string(255)
|
||||
# body :text
|
||||
# permalink :string(255)
|
||||
# lock_version :integer default(0)
|
||||
# updated_by :integer
|
||||
# redirect :integer
|
||||
# parent_id :integer
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,20 @@
|
|||
class SharedSupplier < ActiveRecord::Base
|
||||
|
||||
# connect to database from sharedLists-Application
|
||||
SharedSupplier.establish_connection(Foodsoft.config[:shared_lists])
|
||||
# set correct table_name in external DB
|
||||
set_table_name :suppliers
|
||||
|
||||
|
||||
has_one :supplier
|
||||
has_many :shared_articles, :foreign_key => :supplier_id
|
||||
|
||||
# save the lists as an array
|
||||
serialize :lists
|
||||
|
||||
end
|
||||
|
||||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
#
|
||||
# Table name: suppliers
|
||||
#
|
||||
|
|
@ -16,20 +31,9 @@
|
|||
# created_on :datetime
|
||||
# updated_on :datetime
|
||||
# lists :string(255)
|
||||
# bnn_sync :boolean(1) default(FALSE)
|
||||
# bnn_host :string(255)
|
||||
# bnn_user :string(255)
|
||||
# bnn_password :string(255)
|
||||
#
|
||||
|
||||
class SharedSupplier < ActiveRecord::Base
|
||||
|
||||
# connect to database from sharedLists-Application
|
||||
SharedSupplier.establish_connection(Foodsoft.config[:shared_lists])
|
||||
# set correct table_name in external DB
|
||||
set_table_name :suppliers
|
||||
|
||||
|
||||
has_one :supplier
|
||||
has_many :shared_articles, :foreign_key => :supplier_id
|
||||
|
||||
# save the lists as an array
|
||||
serialize :lists
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,29 +1,3 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: articles
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# name :string(255) default(""), not null
|
||||
# supplier_id :integer default(0), not null
|
||||
# article_category_id :integer default(0), not null
|
||||
# unit :string(255) default(""), not null
|
||||
# note :string(255)
|
||||
# availability :boolean default(TRUE), not null
|
||||
# manufacturer :string(255)
|
||||
# origin :string(255)
|
||||
# shared_updated_on :datetime
|
||||
# price :decimal(, )
|
||||
# tax :float
|
||||
# deposit :decimal(, ) default(0.0)
|
||||
# unit_quantity :integer default(1), not null
|
||||
# order_number :string(255)
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# quantity :integer default(0)
|
||||
# deleted_at :datetime
|
||||
# type :string(255)
|
||||
#
|
||||
|
||||
class StockArticle < Article
|
||||
has_many :stock_changes
|
||||
|
||||
|
|
@ -63,3 +37,30 @@ class StockArticle < Article
|
|||
true
|
||||
end
|
||||
end
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: articles
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# name :string(255) default(""), not null
|
||||
# supplier_id :integer default(0), not null
|
||||
# article_category_id :integer default(0), not null
|
||||
# unit :string(255) default(""), not null
|
||||
# note :string(255)
|
||||
# availability :boolean default(TRUE), not null
|
||||
# manufacturer :string(255)
|
||||
# origin :string(255)
|
||||
# shared_updated_on :datetime
|
||||
# price :decimal(8, 2)
|
||||
# tax :float
|
||||
# deposit :decimal(8, 2) default(0.0)
|
||||
# unit_quantity :integer default(1), not null
|
||||
# order_number :string(255)
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# deleted_at :datetime
|
||||
# type :string(255)
|
||||
# quantity :integer default(0)
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -1,19 +1,3 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: tasks
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# name :string(255) default(""), not null
|
||||
# description :string(255)
|
||||
# due_date :date
|
||||
# done :boolean
|
||||
# workgroup_id :integer
|
||||
# assigned :boolean
|
||||
# created_on :datetime not null
|
||||
# updated_on :datetime not null
|
||||
# required_users :integer default(1)
|
||||
#
|
||||
|
||||
class Task < ActiveRecord::Base
|
||||
has_many :assignments, :dependent => :destroy
|
||||
has_many :users, :through => :assignments
|
||||
|
|
@ -87,3 +71,22 @@ class Task < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: tasks
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# name :string(255) default(""), not null
|
||||
# description :string(255)
|
||||
# due_date :date
|
||||
# done :boolean default(FALSE)
|
||||
# workgroup_id :integer
|
||||
# assigned :boolean default(FALSE)
|
||||
# created_on :datetime not null
|
||||
# updated_on :datetime not null
|
||||
# required_users :integer default(1)
|
||||
# weekly :boolean
|
||||
# duration :integer
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -1,30 +1,3 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: groups
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# type :string(255) default(""), not null
|
||||
# name :string(255) default(""), not null
|
||||
# description :string(255)
|
||||
# account_balance :decimal(, ) default(0.0), not null
|
||||
# account_updated :datetime
|
||||
# created_on :datetime not null
|
||||
# role_admin :boolean not null
|
||||
# role_suppliers :boolean not null
|
||||
# role_article_meta :boolean not null
|
||||
# role_finance :boolean not null
|
||||
# role_orders :boolean not null
|
||||
# weekly_task :boolean
|
||||
# weekday :integer
|
||||
# task_name :string(255)
|
||||
# task_description :string(255)
|
||||
# task_required_users :integer default(1)
|
||||
# deleted_at :datetime
|
||||
# contact_person :string(255)
|
||||
# contact_phone :string(255)
|
||||
# contact_address :string(255)
|
||||
#
|
||||
|
||||
class Workgroup < Group
|
||||
|
||||
has_many :tasks
|
||||
|
|
@ -70,3 +43,32 @@ class Workgroup < Group
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: groups
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# type :string(255) default(""), not null
|
||||
# name :string(255) default(""), not null
|
||||
# description :string(255)
|
||||
# account_balance :decimal(8, 2) default(0.0), not null
|
||||
# account_updated :datetime
|
||||
# created_on :datetime not null
|
||||
# role_admin :boolean default(FALSE), not null
|
||||
# role_suppliers :boolean default(FALSE), not null
|
||||
# role_article_meta :boolean default(FALSE), not null
|
||||
# role_finance :boolean default(FALSE), not null
|
||||
# role_orders :boolean default(FALSE), not null
|
||||
# weekly_task :boolean default(FALSE)
|
||||
# weekday :integer
|
||||
# task_name :string(255)
|
||||
# task_description :string(255)
|
||||
# task_required_users :integer default(1)
|
||||
# deleted_at :datetime
|
||||
# contact_person :string(255)
|
||||
# contact_phone :string(255)
|
||||
# contact_address :string(255)
|
||||
# stats :text
|
||||
#
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue