openaustralia/publicwhip

View on GitHub
app/views/people_distances/_divisions_same.html.haml

Summary

Maintainability
Test Coverage
- if person_distance.nvotessame.positive?
  %section.page-section
    %h2 Divisions in which they voted the same
    = render "summary_vote_numbers", person_distance: @person_distance
    %ol.divisions-list.list-unstyled{class: active_house_for_list_class(nil)}
      - person_distance.divisions_same.order(date: :desc, clock_time: :desc, name: :asc).each do |division|
        -# Doing this terrible hack because some divisions (e.g. representatives/2018-12-04/1) have votes for Julia Bank attached to the wrong member. The votes are attached to the member before she changed party and became independent.
        - member1 = person_distance.person1.members.find {|m| !m.division_vote(division).nil? }
        - member2 = person_distance.person2.members.find {|m| !m.division_vote(division).nil? }
        = render 'divisions/division', members: [member1, member2], house: nil, division: division