tricle 0.2.2 → 0.2.3

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: b642f05f1b01ca4cd31ea2686d60ef99e63d203a
4
- data.tar.gz: c230338123cff716fa9951ec7a2973c059448df3
3
+ metadata.gz: c0460bda7f826c939acd97c2e0334932b9f0ea64
4
+ data.tar.gz: 2d54ea7afaa2b7de1d75f281a4a875ebf3096501
5
5
  SHA512:
6
- metadata.gz: 2ca75aae8ba3b852f2983e4444ba970959586be2209c4dc08209c7a5a0b3910d97e6d0982a0251a7aa7bb7b259c8c886b0d9af8ff8d765a6b53b6ad069543a7b
7
- data.tar.gz: 59a2a220783e513ee84e8d650d213779dbc16735bdbbd7920b386d926b0caa6ff232438989fdf5720410680f8680504ad1101aabe9f4e1ec8f98dc2f7b69c365
6
+ metadata.gz: 0578353886fe5153797d77ef3082e2e90a741812a0381fa1e14844d865a23ec967f3ccfc169032317cff2e8b9d073b86fdccf5950aefea051be67c6bb14b6e88
7
+ data.tar.gz: be52787ddabd878a279254dcee7e529b7f300cdcac285cbfb89a652ee85d87f21bcd0dfee2e6760cf454ebcefa1f8cfe1a7d2a5d04d830872a7e7a38663c0e7e
@@ -25,7 +25,7 @@ module Tricle
25
25
  end
26
26
 
27
27
  def weekly_values(past_num_weeks)
28
- weeks_range = 1..past_num_weeks
28
+ weeks_range = past_num_weeks.downto(1)
29
29
  weeks_range.map{|n| self.weeks_ago(n) }
30
30
  end
31
31
 
@@ -15,29 +15,29 @@
15
15
  <tr>
16
16
  <th><!--Title--></th>
17
17
  <th>
18
- <div>Last week</div>
19
- <%= last_week_dates_cell %>
18
+ <div>Quarterly average</div>
19
+ <%= quarter_dates_cell %>
20
20
  </th>
21
21
  <th>
22
22
  <div>Previous week</div>
23
23
  <%= previous_week_dates_cell %>
24
24
  </th>
25
25
  <th>
26
- <div>Quarterly average</div>
27
- <%= quarter_dates_cell %>
26
+ <div>Last week</div>
27
+ <%= last_week_dates_cell %>
28
28
  </th>
29
29
  </tr>
30
30
  <% section.metrics.each do |metric| %>
31
31
  <tr>
32
32
  <th class="metric-title" rowspan="2"><%= metric.title %></th>
33
+ <%= percent_change_cell(metric.last_week, metric.week_average_this_quarter, metric.better) %>
34
+ <%= percent_change_cell(metric.last_week, metric.weeks_ago(2), metric.better) %>
33
35
  <td>
34
36
  <div><%= format_number(metric.last_week) %></div>
35
37
  <% if metric.total? %>
36
38
  <div><%= format_number(metric.total) %> (total)</div>
37
39
  <% end %>
38
40
  </td>
39
- <%= percent_change_cell(metric.last_week, metric.weeks_ago(2), metric.better) %>
40
- <%= percent_change_cell(metric.last_week, metric.week_average_this_quarter, metric.better) %>
41
41
  </tr>
42
42
  <tr>
43
43
  <td colspan="3">
@@ -1,3 +1,3 @@
1
1
  module Tricle
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
@@ -32,6 +32,13 @@ describe Tricle::Aggregation do
32
32
  end
33
33
  end
34
34
 
35
+ describe '#weekly_values' do
36
+ it "should return the values by week ascending" do
37
+ expect(metric).to receive(:weeks_ago) {|n| n }.exactly(5).times
38
+ expect(metric.weekly_values(5)).to eq([5,4,3,2,1])
39
+ end
40
+ end
41
+
35
42
  describe '#week_average_this_quarter' do
36
43
  it "should average the values provided by #size_for_range" do
37
44
  expect(metric).to receive(:size_for_range).exactly(13).times.and_return(1)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tricle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aidan Feldman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-06 00:00:00.000000000 Z
11
+ date: 2014-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer