Introduce a conflicts controller

This commit is contained in:
Petko Bordjukov 2016-10-06 22:45:08 +03:00
parent 485116e29c
commit f5022dd138
4 changed files with 10 additions and 4 deletions

View File

@ -0,0 +1,5 @@
class ConflictsController < ApplicationController
def index
@talks = Talk.find(:all, from: :halfnarp_friendly).sort_by(&:title)
end
end

View File

@ -0,0 +1,5 @@
<%- csv_headers = ['Event'] + @talks.map { |talk| [talk.title, talk.id].join(' ') } -%>
<%= CSV.generate_line(csv_headers).html_safe -%>
<%- @talks.each do |left| -%>
<%= CSV.generate_line([[left.title, left.id].join(' ')] + @talks.map { |right| left.id == right.id ? '-' : ConflictCoefficient.new(left.id, right.id).per_cent}).html_safe -%>
<%- end -%>

View File

@ -1 +0,0 @@
<%= CSV.generate_line([conflict_coefficient.left, conflict_coefficient.right, conflict_coefficient.conflicts, conflict_coefficient.per_cent]).html_safe -%>

View File

@ -1,3 +0,0 @@
<%- headers = ['left', 'right', 'conflicts', '%'] -%>
<%= CSV.generate_line headers -%>
<%= render partial: 'conflict_coefficient', collection: @conflict_coefficients %>