Skip to content

Commit

Permalink
awesomefoundation#269 defaulting chapter date range to project review…
Browse files Browse the repository at this point in the history
… date range (if defined)
  • Loading branch information
divideby0 committed Jul 7, 2017
1 parent e0eaeef commit 9bff41e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/finalists_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class FinalistsController < ApplicationController
include ApplicationHelper

def index
@start_date, @end_date = extract_timeframe
@start_date, @end_date = extract_timeframe_for_chapter(@chapter)
@projects = Project.
voted_for_by_members_of(current_chapter).
during_timeframe(@start_date, @end_date).
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ProjectsController < ApplicationController
include ApplicationHelper

def index
@start_date, @end_date = extract_timeframe
@start_date, @end_date = extract_timeframe_for_chapter(@chapter)
@short_listed = params[:short_list]

project_filter = ProjectFilter.new(@chapter.projects).during(@start_date, @end_date)
Expand Down
7 changes: 6 additions & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
module ApplicationHelper
def extract_timeframe
start_date = params[:start]
end_date = params[:end]
end_date = params[:end]
end

def extract_timeframe_for_chapter(chapter)
start_date = params[:start] || chapter.project_review_start.to_s
end_date = params[:start] || chapter.project_review_end.to_s
[start_date, end_date]
end

Expand Down

0 comments on commit 9bff41e

Please sign in to comment.