mongoid_occurrences 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.tool-versions +1 -0
- data/CHANGELOG.md +18 -13
- data/lib/mongoid_occurrences/has_occurrences.rb +4 -3
- data/lib/mongoid_occurrences/occurrence/has_operators.rb +4 -0
- data/lib/mongoid_occurrences/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e4691e967789e20737620c8ea0f52adbfe1048b75519cd40f421a56418d5009
|
4
|
+
data.tar.gz: ef6ada74ee76687c7adc4b70c2fffb3916d1a61be3dfbf0c94cc39f64abef192
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b694b25f6f8f1c580a931b36492443c00167f66a781bf96c99da78f610b06724ac853db4404659422b1d14cbc8d6e92a6e39daf29756c91c250c4d9969568422
|
7
|
+
data.tar.gz: 211def0bc924d36485ede7146e10f645d632d6aff4c5714c21ce799651918b0a92c31e89fd3327a47ed9799865358e4fceab0f7403a7a240e4dc6e2b6b7b85cb
|
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 2.6.3
|
data/CHANGELOG.md
CHANGED
@@ -1,50 +1,55 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 1.1.5
|
4
|
+
|
5
|
+
- FIX: wiping `#daily_occurrences` when removing all `#occurrences`
|
6
|
+
- FIX: correctly assign `#daily_occurrences` when changing `#occurrences`
|
7
|
+
|
3
8
|
## 1.1.4
|
4
9
|
|
5
|
-
|
10
|
+
- ADD: default sort order on the `#occurrences` association
|
6
11
|
|
7
12
|
## 1.1.2
|
8
13
|
|
9
|
-
|
14
|
+
- FIX: missing minutes when creating daily occurrences from a schedule
|
10
15
|
|
11
16
|
## 1.1.1
|
12
17
|
|
13
|
-
|
14
|
-
|
18
|
+
- FIX: issues with handling time zone in daily occurrences and queries
|
19
|
+
- ADD: validation on `Occurrence` for `dtend` being after `dtstart`
|
15
20
|
|
16
21
|
## 1.1.0
|
17
22
|
|
18
|
-
|
23
|
+
- CHANGE: `#embedded_in_event` requires `name` (`#embedded_in_event(name, options)`)
|
19
24
|
|
20
25
|
## 1.0.4
|
21
26
|
|
22
|
-
|
27
|
+
- FIX: We rely on occurrences having their `updated_at` field touched when saving an event, which currently doesn't happen. Adding `cascade_callbacks` fixes that.
|
23
28
|
|
24
29
|
## 1.0.3
|
25
30
|
|
26
|
-
|
31
|
+
- ADD: allow to specify `:parent_name` on `.embedded_in_event` macro
|
27
32
|
|
28
33
|
## 1.0.2
|
29
34
|
|
30
|
-
|
35
|
+
- ADD: `DailyOccurrence` has now `oid (occurrence_id)` referring to the original occurrence
|
31
36
|
|
32
37
|
## 1.0.1
|
33
38
|
|
34
|
-
|
39
|
+
- FIX: spelling of `*occurrences_cache_key*` related methods
|
35
40
|
|
36
41
|
## 1.0.0
|
37
42
|
|
38
|
-
|
43
|
+
- REFACTOR: [PR#4](https://github.com/tomasc/mongoid_occurrences/pull/4) Refactor to replace views with aggregations
|
39
44
|
|
40
45
|
## 0.2.0
|
41
46
|
|
42
|
-
|
47
|
+
- [PR#3](https://github.com/tomasc/mongoid_occurrences/pull/3) `all_day` becomes a field
|
43
48
|
|
44
49
|
## 0.1.1
|
45
50
|
|
46
|
-
|
51
|
+
- [PR#2](https://github.com/tomasc/mongoid_occurrences/pull/2) allow :assign_daily_occurrences to be triggerred manually
|
47
52
|
|
48
53
|
## 0.1.0
|
49
54
|
|
50
|
-
|
55
|
+
- initial release
|
@@ -29,14 +29,15 @@ module MongoidOccurrences
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def assign_daily_occurrences!
|
32
|
+
return self.daily_occurrences = nil if occurrences.blank?
|
32
33
|
self.daily_occurrences = begin
|
33
|
-
res = occurrences.
|
34
|
+
res = occurrences.select(&:append).flat_map(&:daily_occurrences)
|
34
35
|
|
35
|
-
occurrences.
|
36
|
+
[occurrences.select(&:remove), occurrences.select(&:replace)].flatten.flat_map(&:daily_occurrences).each do |occurrence|
|
36
37
|
res = res.reject { |res_occurrence| res_occurrence.overlaps?(occurrence) }
|
37
38
|
end
|
38
39
|
|
39
|
-
res += occurrences.
|
40
|
+
res += occurrences.select(&:replace).flat_map(&:daily_occurrences)
|
40
41
|
|
41
42
|
res.sort
|
42
43
|
end
|
@@ -5,6 +5,10 @@ module MongoidOccurrences
|
|
5
5
|
module HasOperators
|
6
6
|
def self.prepended(base)
|
7
7
|
base.scope :with_operators, ->(operators) { criteria.in(_operator: Array(operators)) }
|
8
|
+
|
9
|
+
%i[append replace remove].each do |o|
|
10
|
+
define_method(o) { operator == o }
|
11
|
+
end
|
8
12
|
end
|
9
13
|
|
10
14
|
module ClassMethods
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid_occurrences
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Celizna
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-02-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ice_cube
|
@@ -222,6 +222,7 @@ extensions: []
|
|
222
222
|
extra_rdoc_files: []
|
223
223
|
files:
|
224
224
|
- ".gitignore"
|
225
|
+
- ".tool-versions"
|
225
226
|
- ".travis.yml"
|
226
227
|
- CHANGELOG.md
|
227
228
|
- Gemfile
|