public
Clone URL: git://github.com/paulanthonywilson/yaapt-2.git
rename estimate_total to todo_left plus UI changes
Paul Wilson (author)
Tue Jun 24 14:29:23 -0700 2008
commit  4aedf574fa9af3a3884eb90117a87b21cf1559e1
tree    e20567b8bb6c94244a52321045ead432ff862a4a
parent  bd14b994e6cbfe095d6536237eaad1938f74d3f7
...
4
5
6
7
8
 
 
9
10
11
...
4
5
6
 
 
7
8
9
10
11
0
@@ -4,8 +4,8 @@ module ApplicationHelper
0
     error_messages_for object, {:header_message=>nil, :message=>nil}
0
   end
0
   
0
- def rjs_update_estimate_total(page, release)
0
- page.select('#' + dom_id(release, 'estimate_total')).each {|item| item.update(release.estimate_total)} if release
0
+ def rjs_update_left_todo(page, release)
0
+ page.select('#' + dom_id(release, 'left_todo')).each {|item| item.update(release.left_todo)} if release
0
   end
0
   
0
   def selected_link(text)
...
3
4
5
6
 
7
8
 
9
10
11
...
3
4
5
 
6
7
8
9
10
11
12
0
@@ -3,9 +3,10 @@ module StoriesHelper
0
     "<span class='#{h story.status}'>#{h story.status}</span>"
0
   end
0
 
0
- def advance_button(story)
0
+ def advance_button(story, release=nil)
0
     return "" if story.status == 'done'
0
     return "" unless story.release_id
0
+ return "" unless release
0
     link_to_remote image_tag('advance.png', :alt=>'advance'), {:url=>advance_story_path(story), :method => :put}
0
   end
0
 
...
17
18
19
20
 
21
22
23
...
29
30
31
32
 
33
34
35
...
59
60
61
62
 
63
64
65
...
71
72
73
74
 
75
76
77
...
17
18
19
 
20
21
22
23
...
29
30
31
 
32
33
34
35
...
59
60
61
 
62
63
64
65
...
71
72
73
 
74
75
76
77
0
@@ -17,7 +17,7 @@ class BurndownGraph
0
     histories_to_graph = GraphedHistories.new(@histories).
0
     constrained_to_release_date(@release_date).
0
     constrained_to_start_date(@start_date)
0
- g.data("burndown", histories_to_graph.map(&:estimate_total))
0
+ g.data("burndown", histories_to_graph.map(&:left_todo))
0
     g.minimum_value=0
0
     g.labels = histories_to_graph.labels
0
     g
0
@@ -29,7 +29,7 @@ class BurndownGraph
0
   private
0
 
0
   class GraphedHistories < Array
0
- @@date_and_total = Struct.new(:date, :estimate_total)
0
+ @@date_and_total = Struct.new(:date, :left_todo)
0
     def initialize(histories)
0
       super inflate(histories)
0
     end
0
@@ -59,7 +59,7 @@ class BurndownGraph
0
       compressed.inject([]) do |expanded, history|
0
         unless expanded.empty?
0
           expanded.last.date.tomorrow.upto(history.date.yesterday) do |missing_date|
0
- expanded << @@date_and_total.new(missing_date, expanded.last.estimate_total)
0
+ expanded << @@date_and_total.new(missing_date, expanded.last.left_todo)
0
           end
0
         end
0
         expanded << history
0
@@ -71,7 +71,7 @@ class BurndownGraph
0
         today = Date::today
0
         while(last.date < date) do
0
           next_date = last.date.tomorrow
0
- self << @@date_and_total.new(next_date, next_date < today ? last.estimate_total : nil)
0
+ self << @@date_and_total.new(next_date, next_date < today ? last.left_todo : nil)
0
         end
0
       end
0
     end
...
8
9
10
11
 
12
13
14
15
16
17
18
 
19
20
 
21
22
23
...
8
9
10
 
11
12
13
14
15
16
17
 
18
19
 
20
21
22
23
0
@@ -8,16 +8,16 @@ class Release < ActiveRecord::Base
0
     "#{release_date} - #{name}"
0
   end
0
 
0
- def estimate_total
0
+ def left_todo
0
     stories.reject(&:done?).map{|story| story.estimate ? story.estimate : 0}.sum
0
   end
0
 
0
   def notify_story_change
0
     history_today = release_histories.find_by_history_date(Date::today)
0
     if (history_today)
0
- history_today.update_attributes(:estimate_total=>estimate_total)
0
+ history_today.update_attributes(:left_todo=>left_todo)
0
     else
0
- release_histories.create(:estimate_total=>estimate_total, :history_date=>Date::today)
0
+ release_histories.create(:left_todo=>left_todo, :history_date=>Date::today)
0
     end
0
   end
0
 
...
8
9
10
11
12
 
13
...
8
9
10
 
11
12
13
0
@@ -8,4 +8,4 @@ page << <<-EOS
0
   })
0
   restripe('story_list')
0
 EOS
0
-rjs_update_estimate_total page, @previous_release
0
\ No newline at end of file
0
+rjs_update_left_todo page, @previous_release
0
\ No newline at end of file
...
2
3
4
5
 
6
7
8
...
2
3
4
 
5
6
7
8
0
@@ -2,7 +2,7 @@
0
 if @release
0
   content_for(:content_head) do %>
0
   <h1><%= title %><%=link_to image_tag('edit.png', :alt=>'edit'), edit_release_path(@release) if @release %></h1>
0
-<p>Estimated todo: <%= content_tag :span, @release.estimate_total, :id=>dom_id(@release, 'estimate_total') %></p>
0
+<p>Estimated todo: <%= content_tag :span, @release.left_todo, :id=>dom_id(@release, 'left_todo') %></p>
0
 <p>
0
 <%=link_to 'stories', release_stories_path(@release)%>
0
 <%=link_to "burndown", burndown_release_path(@release)%>
...
1
2
3
 
...
1
2
 
3
0
@@ -1,3 +1,3 @@
0
 <%=link_to image_tag('edit.png', :alt=>'edit'), edit_release_path(@release)%>
0
 <%=link_to "burndown", burndown_release_path(@release)%>
0
-<p>Estimated todo: <%= content_tag :span, @release.estimate_total, :id=>dom_id(@release, 'estimate_total') %></p>
0
+<p>Estimated todo: <%= content_tag :span, @release.left_todo, :id=>dom_id(@release, 'left_todo') %></p>
...
1
 
2
3
4
...
8
9
10
11
 
12
13
14
...
 
1
2
3
4
...
8
9
10
 
11
12
13
14
0
@@ -1,4 +1,4 @@
0
-<% content_tag_for(:div, story, :class=>"#{cycle('odd', 'even')} stripe") do %>
0
+<% content_tag_for(:div, story, :class=>"#{cycle('odd', 'even')} stripe #{story.status}") do %>
0
   <div class="top">
0
   <div id='<%=dom_id(story, 'drag_handle')%>' class='handle'><%=image_tag('handle.png', :width=>'18px') %></div>
0
   <div class='field estimate'><%= h story.estimate %></div>
0
@@ -8,7 +8,7 @@
0
    <div class='edit'><%= link_to image_tag('edit.png', :alt=>'edit'), edit_story_path(story)%></div>
0
    <div class='destroy'><%= link_to image_tag('destroy.png', :alt=>'destroy'), story_path(story), :confirm => 'Delete story?', :method => :delete %></div>
0
   <div class='field'>
0
- <div class='advance_button' id='<%=dom_id(story, 'advance_button')%>'><%= advance_button(story)%></div>
0
+ <div class='advance_button' id='<%=dom_id(story, 'advance_button')%>'><%= advance_button(story, @release)%></div>
0
   <div id='<%=dom_id(story, "status")%>' class='status' ><%= story_status story%></div>
0
   </div>
0
   <div class='field body'><%= h story.body %></div>
...
1
2
 
 
 
 
 
3
4
5
 
6
...
 
 
1
2
3
4
5
6
 
7
8
9
0
@@ -1,4 +1,7 @@
0
-page[dom_id(@story, 'status')].replace_html(story_status(@story)).visual_effect(:highlight)
0
-page[dom_id(@story, 'advance_button')].replace_html(advance_button(@story))
0
+@release = @story.release
0
+page[dom_id(@story)].replace(render(:partial=>'story'))
0
+#page[dom_id(@story, 'advance_button')].replace_html(advance_button(@story))
0
+page << "restripe('story_list')"
0
+page[dom_id(@story)].visual_effect(:highlight, :duration=>3)
0
 
0
-rjs_update_estimate_total page, @story.release
0
\ No newline at end of file
0
+rjs_update_left_todo page, @story.release
0
\ No newline at end of file
...
1
2
 
3
4
5
...
1
 
2
3
4
5
0
@@ -1,5 +1,5 @@
0
 @release = @story.release
0
-rjs_update_estimate_total page, @release
0
+rjs_update_left_todo page, @release
0
 page.insert_html :top, 'story_list', :partial=>'story.html.erb', :locals=>{:story=>@story}
0
 page << "restripe('story_list')"
0
 @story = nil
...
4
5
6
7
 
8
9
...
4
5
6
 
7
8
9
0
@@ -4,6 +4,6 @@ class AddStartDateToRelease < ActiveRecord::Migration
0
   end
0
 
0
   def self.down
0
- remove_column :release, :start_date
0
+ remove_column :releases, :start_date
0
   end
0
 end
...
152
153
154
 
 
 
 
 
 
 
 
 
 
 
155
156
157
...
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
0
@@ -152,6 +152,17 @@ a img{
0
   width: 100%;
0
 }
0
 
0
+div.done{
0
+ border-left: solid green;
0
+ text-decoration: line-through;
0
+}
0
+
0
+div.unstarted{
0
+ border-left: solid red;
0
+}
0
+div.in_progress{
0
+ border-left: solid yellow;
0
+}
0
 
0
 
0
 
...
4
5
6
7
 
8
9
10
11
12
13
14
 
15
...
4
5
6
 
7
8
9
10
11
12
13
 
14
15
0
@@ -4,12 +4,12 @@ day=1
0
 1.upto(15) do |i| %>
0
 tea_and_biscuits_day_<%=i%>:
0
   history_date: 2008-05-<%=day%>
0
- estimate_total: <%= 30 - i %>
0
+ left_todo: <%= 30 - i %>
0
   release: tea_and_biscuits
0
 <%
0
   day+= i % 5 == 0 ? 3 : 1
0
 end %>
0
 dinner_party_day_1:
0
   history_date: '2008-06-03'
0
- estimate_total: 9.99
0
+ left_todo: 9.99
0
   release: dinner_party
...
116
117
118
 
 
 
119
120
...
116
117
118
119
120
121
122
123
0
@@ -116,5 +116,8 @@ class ReleasesControllerTest < ActionController::TestCase
0
     should_not_have_edit_release_link
0
     should_have_release_form_fields "edit_release_#{Fixtures.identify(:tea_and_biscuits)}"
0
   end
0
+
0
+
0
+
0
 
0
 end
...
163
164
165
166
 
167
168
169
...
163
164
165
 
166
167
168
169
0
@@ -163,7 +163,7 @@ class StoriesControllerTest < ActionController::TestCase
0
     should "update status unstarted to in_progress" do
0
       put :advance, :id=>stories(:make_tea)
0
       assert_equal 'in_progress', stories(:make_tea).reload.status
0
- assert_match /update.*in_progress/, @response.body
0
+ assert_template 'advance'
0
     end
0
 
0
     should "fail for status done" do
...
4
5
6
7
 
8
9
10
...
4
5
6
 
7
8
9
10
0
@@ -4,7 +4,7 @@ require 'burndown_graph'
0
 
0
 class BurndownGraphTest < Test::Unit::TestCase
0
 
0
- StubReleaseHistory = Struct.new(:date, :estimate_total)
0
+ StubReleaseHistory = Struct.new(:date, :left_todo)
0
 
0
   def setup
0
     @release = releases(:tea_and_biscuits)
...
1
2
3
4
 
5
6
7
...
1
2
3
 
4
5
6
7
0
@@ -1,7 +1,7 @@
0
 require File.dirname(__FILE__) + '/../test_helper'
0
 
0
 class ReleaseHistoryTest < ActiveSupport::TestCase
0
- should_have_db_columns :history_date, :estimate_total
0
+ should_have_db_columns :history_date, :left_todo
0
   should_belong_to :release
0
   
0
   
...
58
59
60
61
 
62
63
 
64
65
66
67
68
 
69
70
71
...
78
79
80
81
 
82
83
84
85
 
86
87
88
89
 
90
91
92
...
104
105
106
 
 
107
...
58
59
60
 
61
62
 
63
64
65
66
67
 
68
69
70
71
...
78
79
80
 
81
82
83
84
 
85
86
87
88
 
89
90
91
92
...
104
105
106
107
108
109
0
@@ -58,14 +58,14 @@ class ReleaseTest < ActiveSupport::TestCase
0
     should_be_ordered_descending_by_release_date
0
   end
0
 
0
- context "estimate_total" do
0
+ context "left_todo" do
0
     should "be total of estimates of stories that are not done" do
0
- assert_equal 3, releases(:tea_and_biscuits).estimate_total
0
+ assert_equal 3, releases(:tea_and_biscuits).left_todo
0
     end
0
     
0
     should "consider nil estimate to be zero" do
0
       releases(:tea_and_biscuits).stories << Story.new
0
- assert_equal 3, releases(:tea_and_biscuits).estimate_total
0
+ assert_equal 3, releases(:tea_and_biscuits).left_todo
0
     end
0
   end
0
 
0
@@ -78,15 +78,15 @@ class ReleaseTest < ActiveSupport::TestCase
0
 
0
     should "populate event history for the day with the estimate total" do
0
       @release.notify_story_change
0
- assert_equal 3, @release.release_histories.find_by_history_date(@today).estimate_total
0
+ assert_equal 3, @release.release_histories.find_by_history_date(@today).left_todo
0
     end
0
 
0
     should "only create one entry per day" do
0
- @release.release_histories.create(:estimate_total=>5, :history_date=>@today)
0
+ @release.release_histories.create(:left_todo=>5, :history_date=>@today)
0
       @release.notify_story_change
0
       today_histories = @release.release_histories.find_all_by_history_date(@today)
0
       assert_equal 1, today_histories.size
0
- assert_equal 3, today_histories.first.estimate_total
0
+ assert_equal 3, today_histories.first.left_todo
0
     end
0
   end
0
   
0
@@ -104,4 +104,6 @@ class ReleaseTest < ActiveSupport::TestCase
0
       @release.to_burndown_graph
0
     end
0
   end
0
+
0
+
0
 end
...
12
13
14
15
 
16
17
 
18
 
 
19
20
21
22
 
23
24
25
26
27
 
 
 
 
 
 
28
 
 
 
29
30
31
...
12
13
14
 
15
16
 
17
18
19
20
21
22
23
 
24
25
26
27
28
 
29
30
31
32
33
34
35
36
37
38
39
40
41
0
@@ -12,20 +12,30 @@ class StoriesHelperTest < ActiveSupport::TestCase
0
     assert_equal "<span class='h'd(unstarted)'>h'd(unstarted)</span>", story_status(story)
0
   end
0
 
0
- def test_advance_button
0
+ def test_advance_button_for_unstarted_story
0
     story = Story.new(:id=>25, :status=>'unstarted', :release_id=>1)
0
- assert_match /link_to_remote\(.*advance.*\)/, advance_button(story)
0
+ assert_match /link_to_remote\(.*advance.*\)/, advance_button(story, Release.new)
0
   end
0
+
0
+
0
 
0
   def test_advance_button_not_shown_for_done_stories
0
     story = Story.new(:id=>25, :status=>'done')
0
- assert_equal '', advance_button(story)
0
+ assert_equal '', advance_button(story, nil)
0
   end
0
 
0
   def test_advance_button_not_shown_for_stories_without_release
0
     story = Story.new(:id=>25, :status=>'unstarted')
0
- assert_equal '', advance_button(story)
0
+ assert_equal '', advance_button(story, nil)
0
+ end
0
+
0
+ def test_advance_button_not_shown_if_release_not_provided
0
+ story = Story.new(:id=>25, :status=>'unstarted', :release_id=>1)
0
+ assert_equal '', advance_button(story, nil)
0
   end
0
+
0
+
0
+
0
 
0
 
0
   context "release description cell" do

Comments

    No one has commented yet.