trusty-festivity-extension 2.0.7 → 2.1.0

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
- NGZiOTZhZTc5NzI0MGI0ZGJiNDE5Mjg0NjhkMTk1ZmNhN2ZjOGM5ZQ==
4
+ NGQxN2I5NDA1ZjZlZWUxYzg0MWRlY2JjMmEwN2I1OWI5NDdiYzNhMA==
5
5
  data.tar.gz: !binary |-
6
- YWRmN2Q4MWJlMDk0MTYyZTUzYTFkZmUzOWZhN2NiZGM2YmRlNGQwMQ==
6
+ ZTYxZjIzZDNjMjdiNDRjM2Q5NDY0YzhlYmEyZjBjNjJmMzIwNDRiOA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YzQzYmYwODQ1NzU1OTZiYmRkMDFlOTc1MzEzYzg2MjgzN2I0ZTkwMDgyM2Mw
10
- YjZhNmVjMGFlYjEzYzJlODk3MDkxZTI0YzBlN2EzOTI4YTc3OGYwMjRlYmRi
11
- ZTY5MDQxZTQ0ZWMyN2IwYmRmZDIzMDY3MzBkNzRkYTEwMjYwNWU=
9
+ NDMwYzJkZjQ2ZWM2NDYxZjk1MGVlZGJjOGIxM2Q4ZjUxNDczNDcwYWRhODJi
10
+ ZTgxYmMwNjlkMWE4OWFiMDZiNjI0OGU4NjNmMWMyZDU5Y2NiODA3ZDFlOWFi
11
+ NmJkYjVkOTM1MzQ0MmZiNjRlNGVlOTQ1YTM5MWU5YjZhY2IzNTQ=
12
12
  data.tar.gz: !binary |-
13
- M2E1Njk3M2Q4YWMzNGRhMGY0ZmRmZjk2ZGJmY2Q0YzEzZDc5ZmY1MmRkNjQy
14
- ZDc0NzIyNDE1YWI0YmQzMGU3OTc4NjJmZGU0ZTk1YjEyZTdmYzc3OGU2ZGMx
15
- ZDM3Y2I5MjJlMzZlYTY2MzQzM2NhZGZjZDk1YTQ1MTU3NWQ4YzM=
13
+ NjA0YzQyOTlmZjVkODc2MjBkZDRiODNjNmQ5OTQ5NmMyOTE3YjU0NjhkMjc1
14
+ YzkzNzllNjcxYTMwNDUzMzc0NDgxMDBkMTgwNGU3ZWIyNDBkNmM4ZjBiMTRj
15
+ ZDVhYjcxMTUyZDc5YzAzNDFhZjNkMmJhNDA5MjU5NTJmZjJmOTE=
@@ -78,13 +78,21 @@ class FestivityEventList
78
78
  # - The event ids returned, if any, are added to the where clause for the next query
79
79
  # - Any category ids passed are added to the where clause as well.
80
80
  def self.parse_criteria(criteria)
81
- where_clause = {}
82
81
  event_ids = event_ids_for_dates(criteria[:dates]) if criteria[:dates]
83
- where_clause["site_id"] = Page.current_site.id
84
- where_clause["event_id"] = event_ids if event_ids
85
- where_clause["festivity_categories.id"] = criteria[:categories].split(",") if criteria[:categories]
82
+ where_clause = "site_id = #{ Page.current_site.id}"
83
+ where_clause += " AND event_id IN (#{event_ids.join(",")})" if event_ids
84
+ where_clause += " AND #{parse_categories(criteria[:categories].split(","))}" if criteria[:categories]
86
85
  where_clause
87
86
  end
88
87
 
88
+ def self.parse_categories(category_ids)
89
+ grouped_ids = FestivityCategory.find(category_ids).group_by {|category| category.festivity_category_type}
90
+ category_clauses = grouped_ids.map do |categories|
91
+ "page_id IN (SELECT page_id FROM festivity_page_categories WHERE festivity_category_id IN (#{categories[1].map {|category| category.id}.join(",")}))"
92
+ end
93
+ "(#{category_clauses.join(" AND ")})"
94
+
95
+ end
96
+
89
97
 
90
98
  end
@@ -1,5 +1,5 @@
1
1
  module TrustyFestivityExtension
2
- VERSION = "2.0.7"
2
+ VERSION = "2.1.0"
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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trusty-festivity-extension
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.7
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Sipple
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-25 00:00:00.000000000 Z
11
+ date: 2015-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trusty-cms