day_planner 0.1.0.pre29 → 0.1.0.pre30

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c1ad680447e4268511ebefbc6159f2b913e54d54
4
- data.tar.gz: 13f8a30fec04cd055a3bae324626a6d6ca8d2642
3
+ metadata.gz: 16fe32a951d2e380d2505cd56d6fef46ed3d3c87
4
+ data.tar.gz: 2447869ab904825010d2201b0f9346ea615af3b6
5
5
  SHA512:
6
- metadata.gz: 869fa1d2a1f2dd8853f9d9090eca84359e605c0096cf9490d684239515dea32c57d8f9a039b274900960f75dd03debb309e499e9db01121b875ac307f117c90c
7
- data.tar.gz: 6c2133f1052ada9fdfb7d140f4c6b3ef6d4e8835534d1b645247b1c289056036f915f9048a4cf5ac6148037fd3a4778bd19e6e06416054a85512b40aaf95956d
6
+ metadata.gz: 89356fc569473819f7d838cbea2196f84053bc4c57b06675144664bf496280f17fe342e8fea95bffefbe28ac504d1d7c06a5dabfd45ef3decdb8168db22b0f5c
7
+ data.tar.gz: d9e7d857e80f3c22a3722c597c49c364b856305e933787e7e351aee0d08e1264e512880f000861931f61f25c337b201bd5b41f708ddd24616d461a9143e1306e
@@ -16,15 +16,21 @@ module DayPlanner
16
16
  fields = {}
17
17
  fields[:name] = options.delete(:name) if options[:name]
18
18
  fields[:interval] = options.delete(:every).to_i if options[:every]
19
- fields[:last_execution] = Time.parse("1/1/1")
19
+ # fields[:last_execution] = Time.parse("1/1/1")
20
20
 
21
21
  task = DayPlanner::Task.create(fields)
22
22
  end
23
23
 
24
24
  def log(last, now)
25
25
  if ActiveRecord::Base.connection.table_exists?('day_planner_log')
26
- deviation = -(last + interval - now)
27
- DayPlanner::Log.create(name: name, interval: interval, datetime: now, deviation: deviation)
26
+ if !last.nil?
27
+ deviation = -(last + interval - now)
28
+ else
29
+ deviation = 0
30
+ end
31
+ cumulative_deviation = self.cumulative_deviation || 0
32
+ cumulative_deviation += deviation
33
+ DayPlanner::Log.create(name: name, interval: interval, datetime: now, deviation: deviation, cumulative_deviation: cumulative_deviation)
28
34
  end
29
35
  end
30
36
 
@@ -5,6 +5,7 @@ class CreateDayPlannerLog < ActiveRecord::Migration
5
5
  t.integer :interval
6
6
  t.datetime :datetime
7
7
  t.decimal :deviation, precision: 15, scale: 6
8
+ t.decimal :cumulative_deviation, precision: 15, scale: 6
8
9
  end
9
10
  end
10
11
 
@@ -2,7 +2,7 @@ module DayPlanner
2
2
  MAJOR = 0
3
3
  MINOR = 1
4
4
  TINY = 0
5
- PRE = "pre29"
5
+ PRE = "pre30"
6
6
  BUILD = nil
7
7
 
8
8
  VERSION = [MAJOR, MINOR, TINY, PRE, BUILD].compact.join(".")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: day_planner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre29
4
+ version: 0.1.0.pre30
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damon Siefert