Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
  • 2 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
View
24 LICENSE
@@ -1,20 +1,10 @@
-Copyright (c) 2012 Holder De Ord
+Copyright (c) 2012, Holder De Ord
+All rights reserved.
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
+* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+* Neither the name of the Holder De Ord nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
14 app/models/vote.rb
@@ -23,22 +23,24 @@ def minutes_url
end
class Stats
+ attr_reader :for_count, :against_count, :absent_count
+
def initialize(for_count, against_count, absent_count)
@for_count = for_count || 0
@against_count = against_count || 0
@absent_count = absent_count || 0
end
- def for
- @for ||= percentage_of @for_count, @for_count + @against_count
+ def for_percent
+ @for_percent ||= percentage_of @for_count, @for_count + @against_count
end
- def against
- @against ||= percentage_of @against_count, @for_count + @against_count
+ def against_percent
+ @against_percent ||= percentage_of @against_count, @for_count + @against_count
end
- def missing
- @missing ||= percentage_of @absent_count, @for_count + @against_count + @absent_count
+ def missing_percent
+ @missing_percent ||= percentage_of @absent_count, @for_count + @against_count + @absent_count
end
private
View
6 app/views/shared/_votes_summary_table.html.erb
@@ -27,9 +27,9 @@
<td><%= vote.enacted_text %></td>
<% stats = vote.stats %>
- <td class="vote-for"><%= stats.for %>% (<%= vote.for_count %>)</td>
- <td class="vote-against"><%= stats.against %>% (<%= vote.against_count %>)</td>
- <td class="vote-missing"><%= stats.missing %>% (<%= vote.missing_count %>)</td>
+ <td class="vote-for"><%= stats.for_percent %>% (<%= vote.for_count %>)</td>
+ <td class="vote-against"><%= stats.against_percent %>% (<%= vote.against_count %>)</td>
+ <td class="vote-missing"><%= stats.missing_percent %>% (<%= vote.missing_count %>)</td>
<td><%= link_to t('app.show'), vote, {class: 'btn'} %></td>
</tr>
View
6 app/views/votes/show.html.erb
@@ -18,13 +18,13 @@
<% stats = @vote.stats %>
<dt><%= Vote.human_attribute_name :for_count %></dd>
- <dd><%= stats.for %>% (<%= @vote.for_count %>)</dt>
+ <dd><%= stats.for_percent %>% (<%= @vote.for_count %>)</dt>
<dt><%= Vote.human_attribute_name :against_count %></dd>
- <dd><%= stats.against %>% (<%= @vote.against_count %>)</dt>
+ <dd><%= stats.against_percent %>% (<%= @vote.against_count %>)</dt>
<dt><%= Vote.human_attribute_name :missing_count %></dd>
- <dd><%= stats.missing %>% (<%= @vote.missing_count %>)</dt>
+ <dd><%= stats.missing_percent %>% (<%= @vote.missing_count %>)</dt>
</dl>
</div>

No commit comments for this range

Something went wrong with that request. Please try again.