trusty-festivity-extension 2.2.5 → 2.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODM1ZTdlNDdiNDhlMjBiYzkwNTU4MDc2MjJhMzAyNmY3MTJhOTUzNw==
4
+ ZjUyYTY5YTdhOTQyYjY4M2ZlMGM3MGFhZmJkYTJmY2Y2YTk3OTZkZQ==
5
5
  data.tar.gz: !binary |-
6
- MDI0OWQ4ZjU5NWNkNDZiNGE3OGNlZDhiNzQwMDk3MmJlNjI0YmYxZA==
6
+ YjM2OTY4YWI5NTkyZGU2NTM0NzBkZWE2Yjc0MDk4MDViMGFjNWQ4MQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YzU4OWUzYWI2MGExYjNlNzQ3NzIxM2JiNmE0YTI1YzE5ZmE2MWM1NjE2NWJj
10
- YjBiMDIwM2NmMGM2YWE3ZWIwNGMwYjM0MjM5M2NjYmJhOGY4NTkwYTQzZTc3
11
- YTY3ZjgyMmYyZGYxZTYwNDZiNzMyYzJkNWM2MGY0NTFlYzU5Mzk=
9
+ ZTU3N2U5YWIzM2EwY2VlMTU4ZjA3MzEzZTBkODNiZDkwNDc2MzM1NWI3MjJk
10
+ YzRjYjhjMjkxNTkxZGFkMWE5ZDlkNzQ3YWU3NGUzYWI3MDkxZjFkMzRhMDJk
11
+ NzcwMGNmMmY2NmQ2NmM3ZGZhNjJmMjM2N2ViNTJiNGM2Nzk0ZDQ=
12
12
  data.tar.gz: !binary |-
13
- NTk3NWJlODQxNWJkZGY2NDdiMmRhYWUwNmZhNzdlZmQ3NTgzOWRjYzlhMTI2
14
- MGJhMjRjOTZkZDY2OGNkZTYyNTMyMDM0Y2NjMmZlZmM2ODVkMzEwYWM5Nzg0
15
- Y2Q3MTY5ZGNmZWFkMTJkMTk3MTkzZDY4MDE2MmE1ODU2ZDlhZWI=
13
+ M2Y0NDQ0YTNjMTU3ZTA1MTM3ZTRlMzQzYzAzMTFlMTFkMjNlMmZkYmI4YzAy
14
+ NzQ2ODE1ODVjYjM4ZjY5MTYxZDFjZDM2ZTc1YjEyNGUxODFlYmRjZjNkNjc3
15
+ NTE0YThjYThkNWEwMjlmNTA5NjczY2ZkMTc3ZjY4M2NmOWQ3MDU=
@@ -19,7 +19,7 @@ class FestivityEventsController < ApplicationController
19
19
  end
20
20
 
21
21
 
22
- @selected_dates = params[:dates] ? params[:dates].split(",") : []
22
+ @selected_dates = params[:dates] ? FestivityDatetimeFilterPresenter.parse(params[:dates].split(","), current_site.festivity_filter_type) : []
23
23
  @selected_categories = params[:categories] ? params[:categories].split(",") : []
24
24
  @selected_sort = order_by
25
25
  # If the request is AJAX, only return the event list itself, not the full page
@@ -9,7 +9,12 @@ class FestivityEventList
9
9
  end
10
10
 
11
11
  def self.search(criteria, order_by)
12
+ begin
12
13
  where_clause = parse_criteria(criteria)
14
+ rescue ActiveRecord::RecordNotFound
15
+ return FestivityEventList.new([])
16
+ end
17
+
13
18
  # where in event ids
14
19
  FestivityEventList.new(
15
20
  FestivityEventList::FestivityEventPerformance.
@@ -59,7 +64,7 @@ class FestivityEventList
59
64
  # for each date passed in and return the SQL condition
60
65
  def self.datetime_criteria(datetimes_string, filter_type)
61
66
  date_queries = datetimes_string.split(',').map do |date_string|
62
- start_date = DateTime.parse(URI.decode(date_string))
67
+ start_date = Chronic.parse(date_string)
63
68
  end_date = start_date.advance(advance_by(filter_type))
64
69
  <<-SQL
65
70
  (
@@ -84,7 +89,11 @@ class FestivityEventList
84
89
  # - The event ids returned, if any, are added to the where clause for the next query
85
90
  # - Any category ids passed are added to the where clause as well.
86
91
  def self.parse_criteria(criteria)
87
- event_ids = event_ids_for_datetimes(criteria[:dates], criteria[:filter_type]) if criteria[:dates]
92
+ if criteria[:dates]
93
+ event_ids = event_ids_for_datetimes(criteria[:dates], criteria[:filter_type])
94
+ raise ActiveRecord::RecordNotFound unless event_ids.any?
95
+ end
96
+
88
97
  where_clause = "site_id = #{ Page.current_site.id}"
89
98
  where_clause += " AND event_id IN (#{event_ids.join(",")})" if event_ids.present?
90
99
  where_clause += " AND #{parse_categories(criteria[:categories].split(","))}" if criteria[:categories]
@@ -5,6 +5,10 @@ class FestivityDatetimeFilterPresenter
5
5
 
6
6
  end
7
7
 
8
+ def self.parse(datetimes, datetime_type)
9
+ self.new(datetimes.map{|date| Chronic.parse(date)}, datetime_type)
10
+ end
11
+
8
12
  private
9
13
 
10
14
  def self.datetime_type_class(datetime_type)
@@ -5,6 +5,10 @@ class FestivityDatetimePresenter
5
5
  @datetime = datetime
6
6
  end
7
7
 
8
+ def ==(other_object)
9
+ @datetime == other_object.datetime
10
+ end
11
+
8
12
  def display_as_date
9
13
  @datetime.strftime("%a, %B %-d")
10
14
  end
@@ -24,7 +24,7 @@
24
24
  %li
25
25
  .checkbox
26
26
  %label
27
- - checked = @selected_dates.include? datetime
27
+ - checked = @selected_dates.any? {|selected_date| selected_date == datetime}
28
28
  %input{type: "checkbox", value: datetime.to_s, checked: checked, data: {filter: "Date", sort: datetime.to_s}}
29
29
  = datetime.display
30
30
  - current_site.festivity_active_category_types.each do |type|
@@ -1,5 +1,5 @@
1
1
  module TrustyFestivityExtension
2
- VERSION = "2.2.5"
2
+ VERSION = "2.2.6"
3
3
  SUMMARY = "Festival microsite engine for Trusty CMS"
4
4
  DESCRIPTION = "Event management for arts festivals."
5
5
  URL = "http://github.com/pgharts/trusty-festivity-extension"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trusty-festivity-extension
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.5
4
+ version: 2.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Sipple