trollo 0.1.9 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/trollo/board.rb CHANGED
@@ -4,6 +4,21 @@ module Trollo
4
4
  has_many :lists, order: 'ordinal ASC', dependent: :destroy
5
5
  has_many :subscriptions, dependent: :destroy
6
6
  attr_accessible :name
7
+
8
+ def tasks
9
+ task_ids = lists.map(&:cards).flatten.compact.map(&:tasklists).flatten.compact.map(&:tasks).flatten.compact.map(&:id)
10
+ Task.where(id: task_ids)
11
+ end
12
+
13
+ def incomplete_tasks
14
+ task_ids = lists.map(&:cards).flatten.compact.map(&:tasklists).flatten.compact.map(&:tasks).flatten.compact.select{|t| t.incomplete?}.map(&:id)
15
+ Task.where(id: task_ids)
16
+ end
17
+
18
+ def overdue_tasks
19
+ task_ids = lists.map(&:cards).flatten.compact.map(&:tasklists).flatten.compact.map(&:tasks).flatten.compact.select{|t| t.overdue?}.map(&:id)
20
+ Task.where(id: task_ids)
21
+ end
7
22
  end
8
23
 
9
24
  end
data/lib/trollo/task.rb CHANGED
@@ -10,6 +10,8 @@ module Trollo
10
10
  after_destroy :update_tasklist
11
11
  attr_accessible :name, :group, :workflow_state, :due_at, :trollable
12
12
 
13
+ scope :search, lambda {|term| unless term.blank?;where("name LIKE :q", q: "%#{term}%");end;}
14
+
13
15
  workflow do
14
16
  state :incomplete do
15
17
  event :finish, :transitions_to => :complete
@@ -1,3 +1,3 @@
1
1
  module Trollo
2
- VERSION = "0.1.9"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trollo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-04 00:00:00.000000000 Z
12
+ date: 2014-06-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport