Export only this year's talk preferences

This commit is contained in:
Petko Bordjukov 2016-10-04 14:00:30 +03:00
parent 9cbb51456c
commit 5e83ea8b3c
2 changed files with 6 additions and 2 deletions

View File

@ -9,8 +9,7 @@ class HomeController < ApplicationController
end
def export
@talks = Talk.find(:all, from: :halfnarp_friendly)
@talk_preferences = TalkPreference.all
@talk_preferences = TalkPreference.this_years
end
def conflicts

View File

@ -13,6 +13,11 @@ class TalkPreference < ActiveRecord::Base
ids.all? { |id| include? id }
end
def self.this_years
timespan = Time.now.change(month: 1, day: 1, hour: 0)..Time.now.change(month: 12, day: 1, hour: 0)
where created_at: timespan
end
private
def assign_new_unique_id