Merge branch 'master' into rails3
Conflicts: .gitignore app/models/task.rb app/models/workgroup.rb app/views/shared/_group_form.html.haml config/locales/de.yml db/schema.rb
This commit is contained in:
commit
182742fbec
10 changed files with 46 additions and 26 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -11,4 +11,5 @@ public/**/*_cached.*
|
||||||
config/initializers/secret_token.rb
|
config/initializers/secret_token.rb
|
||||||
.idea
|
.idea
|
||||||
.rvmrc
|
.rvmrc
|
||||||
|
.get-dump.yml
|
||||||
.rbenv-version
|
.rbenv-version
|
||||||
|
|
|
@ -51,6 +51,8 @@ After that you get the other gems easily with (from project root):
|
||||||
(5) Create database (schema) and load defaults
|
(5) Create database (schema) and load defaults
|
||||||
--------------------------
|
--------------------------
|
||||||
rake db:create
|
rake db:create
|
||||||
|
rake db:schema:load
|
||||||
|
rake db:seed
|
||||||
|
|
||||||
With this, you also get a ready to go user with username 'admin' and password 'secret'.
|
With this, you also get a ready to go user with username 'admin' and password 'secret'.
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,12 @@ class Ordergroup < Group
|
||||||
stats[:orders_sum] != 0 ? stats[:jobs_size].to_f / stats[:orders_sum].to_f : 0
|
stats[:orders_sum] != 0 ? stats[:jobs_size].to_f / stats[:orders_sum].to_f : 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# This is the ordergroup job per euro performance
|
||||||
|
# in comparison to the hole foodcoop average
|
||||||
|
def apples
|
||||||
|
((avg_jobs_per_euro / Ordergroup.avg_jobs_per_euro) * 100).to_i rescue 0
|
||||||
|
end
|
||||||
|
|
||||||
# Global average
|
# Global average
|
||||||
def self.avg_jobs_per_euro
|
def self.avg_jobs_per_euro
|
||||||
stats = Ordergroup.all.collect(&:stats)
|
stats = Ordergroup.all.collect(&:stats)
|
||||||
|
|
|
@ -5,18 +5,19 @@ class Workgroup < Group
|
||||||
# returns all non-finished tasks
|
# returns all non-finished tasks
|
||||||
has_many :open_tasks, :class_name => 'Task', :conditions => ['done = ?', false], :order => 'due_date ASC'
|
has_many :open_tasks, :class_name => 'Task', :conditions => ['done = ?', false], :order => 'due_date ASC'
|
||||||
|
|
||||||
validates_presence_of :task_name, :weekday, :task_required_users,
|
validates_presence_of :task_name, :weekday, :task_required_users, :next_weekly_tasks_number,
|
||||||
:if => Proc.new {|workgroup| workgroup.weekly_task }
|
:if => :weekly_task
|
||||||
|
validates_numericality_of :next_weekly_tasks_number, :greater_than => 0, :less_than => 21, :only_integer => true,
|
||||||
|
:if => :weekly_task
|
||||||
validate :last_admin_on_earth, :on => :update
|
validate :last_admin_on_earth, :on => :update
|
||||||
before_destroy :check_last_admin_group
|
before_destroy :check_last_admin_group
|
||||||
|
|
||||||
|
|
||||||
def self.weekdays
|
def self.weekdays
|
||||||
[["Montag", "1"], ["Dienstag", "2"], ["Mittwoch","3"],["Donnerstag","4"],["Freitag","5"],["Samstag","6"],["Sonntag","0"]]
|
[["Montag", "1"], ["Dienstag", "2"], ["Mittwoch","3"],["Donnerstag","4"],["Freitag","5"],["Samstag","6"],["Sonntag","0"]]
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns an Array with date-objects to represent the next weekly-tasks
|
# Returns an Array with date-objects to represent the next weekly-tasks
|
||||||
def next_weekly_tasks(number = 8)
|
def next_weekly_tasks
|
||||||
# our system starts from 0 (sunday) to 6 (saturday)
|
# our system starts from 0 (sunday) to 6 (saturday)
|
||||||
# get difference between groups weekday and now
|
# get difference between groups weekday and now
|
||||||
diff = self.weekday - Time.now.wday
|
diff = self.weekday - Time.now.wday
|
||||||
|
@ -29,7 +30,7 @@ class Workgroup < Group
|
||||||
end
|
end
|
||||||
# now generate the Array
|
# now generate the Array
|
||||||
nextTasks = Array.new
|
nextTasks = Array.new
|
||||||
number.times do
|
next_weekly_tasks_number.times do
|
||||||
nextTasks << nextTask.to_date
|
nextTasks << nextTask.to_date
|
||||||
nextTask = 1.week.from_now(nextTask)
|
nextTask = 1.week.from_now(nextTask)
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,7 +14,7 @@ unless global_avg == 0 or global_avg.nan?
|
||||||
%>
|
%>
|
||||||
Engagement Deiner Bestellgruppe
|
Engagement Deiner Bestellgruppe
|
||||||
<div class="stats-bar" style="width:<%= length_of_group_bar -%>px; background-color:<%= color -%>">
|
<div class="stats-bar" style="width:<%= length_of_group_bar -%>px; background-color:<%= color -%>">
|
||||||
<%= ((group_avg / global_avg) * 100).to_i -%><%= " Äpfel" if length_of_group_bar > 50 -%>
|
<%= @ordergroup.apples -%><%= " Äpfel" if length_of_group_bar > 50 -%>
|
||||||
</div>
|
</div>
|
||||||
Durchschnittsengagement
|
Durchschnittsengagement
|
||||||
<div class="stats-bar" style="width:<%= length_of_global_bar -%>px">
|
<div class="stats-bar" style="width:<%= length_of_global_bar -%>px">
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
class AddNextWeeklyTasksNumberToWorkgroups < ActiveRecord::Migration
|
||||||
|
def self.up
|
||||||
|
add_column :groups, :next_weekly_tasks_number, :integer, :default => 8
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.down
|
||||||
|
remove_column :groups, :next_weekly_tasks_number
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20120512211613) do
|
ActiveRecord::Schema.define(:version => 20120622094337) do
|
||||||
|
|
||||||
create_table "article_categories", :force => true do |t|
|
create_table "article_categories", :force => true do |t|
|
||||||
t.string "name", :default => "", :null => false
|
t.string "name", :default => "", :null => false
|
||||||
|
@ -155,6 +155,7 @@ ActiveRecord::Schema.define(:version => 20120512211613) do
|
||||||
t.string "contact_address"
|
t.string "contact_address"
|
||||||
t.text "stats"
|
t.text "stats"
|
||||||
t.integer "task_duration", :default => 1
|
t.integer "task_duration", :default => 1
|
||||||
|
t.integer "next_weekly_tasks_number", :default => 8
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "groups", ["name"], :name => "index_groups_on_name", :unique => true
|
add_index "groups", ["name"], :name => "index_groups_on_name", :unique => true
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace :foodsoft do
|
||||||
workgroups = Workgroup.all :conditions => {:weekly_task => true}
|
workgroups = Workgroup.all :conditions => {:weekly_task => true}
|
||||||
for workgroup in workgroups
|
for workgroup in workgroups
|
||||||
puts "Create weekly tasks for #{workgroup.name}"
|
puts "Create weekly tasks for #{workgroup.name}"
|
||||||
workgroup.next_weekly_tasks(8)[3..5].each do |date|
|
workgroup.next_weekly_tasks[3..5].each do |date|
|
||||||
unless workgroup.tasks.exists?({:due_date => date, :weekly => true})
|
unless workgroup.tasks.exists?({:due_date => date, :weekly => true})
|
||||||
workgroup.tasks.create(workgroup.task_attributes(date))
|
workgroup.tasks.create(workgroup.task_attributes(date))
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
#nav ul {
|
#nav ul {
|
||||||
margin: 0; }
|
margin: 0; }
|
||||||
#nav ul li.current a:hover {
|
#nav ul li.current a:hover {
|
||||||
color: #fff; }
|
color: white; }
|
||||||
#nav ul li.current ul {
|
#nav ul li.current ul {
|
||||||
width: 100%; }
|
width: 100%; }
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
padding: 0.5em 1.2em 0.6em 1.2em;
|
padding: 0.5em 1.2em 0.6em 1.2em;
|
||||||
margin-top: 0; }
|
margin-top: 0; }
|
||||||
#nav ul li a:hover {
|
#nav ul li a:hover {
|
||||||
color: #ED0606; }
|
color: #ed0606; }
|
||||||
#nav ul li ul {
|
#nav ul li ul {
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -36,22 +36,22 @@
|
||||||
padding: 0.6em;
|
padding: 0.6em;
|
||||||
bottom: -1.4em;
|
bottom: -1.4em;
|
||||||
right: 0em;
|
right: 0em;
|
||||||
background: #ED0606; }
|
background: #ed0606; }
|
||||||
#nav ul li ul li {
|
#nav ul li ul li {
|
||||||
border-left: 0.1em dotted white;
|
border-left: 0.1em dotted white;
|
||||||
background: none; }
|
background: none; }
|
||||||
#nav ul li ul a, #nav ul li ul a:hover {
|
#nav ul li ul a, #nav ul li ul a:hover {
|
||||||
border: none;
|
border: none;
|
||||||
background: none;
|
background: none;
|
||||||
color: #FFF;
|
color: white;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-size: 1em; }
|
font-size: 1em; }
|
||||||
#nav ul li.current a {
|
#nav ul li.current a {
|
||||||
border: none;
|
border: none;
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
background: #ED0606;
|
background: #ed0606;
|
||||||
padding-bottom: 0.6em;
|
padding-bottom: 0.6em;
|
||||||
color: #FFF; }
|
color: white; }
|
||||||
#nav ul li.current ul {
|
#nav ul li.current ul {
|
||||||
display: inline; }
|
display: inline; }
|
||||||
#nav ul li.current ul a {
|
#nav ul li.current ul a {
|
||||||
|
|
Loading…
Reference in a new issue