mongoid_recurring 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d85b73b3c24c54091208f08e81cacb20de632f14
|
4
|
+
data.tar.gz: eac9e4fc14653e733a10d782a5b684f5bd4c1856
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a01e15f26a9c90f8d3676a936fb031c912012db423407ba1af13a10b53960bcf31661b1b85f5acfa00d2600b3b3f28f9a4ffac8b700023838b1c6681cdf2382
|
7
|
+
data.tar.gz: 97aade14ef57dbfb29987a44fc5b7a2c2a7bc011d435b18e45e0d0d8ea1ad94c13802d4d249d9d6f3b97e0de3a4e1790875dbcac93b429c3a03fa002119ff5e6
|
@@ -35,19 +35,15 @@ module MongoidRecurring
|
|
35
35
|
# ---------------------------------------------------------------------
|
36
36
|
|
37
37
|
scope :for_datetime_range, -> (dtstart, dtend) {
|
38
|
-
|
39
|
-
dtend = dtend.end_of_day if dtend.instance_of?(Date)
|
40
|
-
where({ occurrences: { "$elemMatch" => { :dtstart.lte => dtend.to_datetime, :dtend.gte => dtstart.to_datetime } } })
|
38
|
+
where({ occurrences: { "$elemMatch" => Occurence.for_datetime_range(dtstart, dtend).selector } })
|
41
39
|
}
|
42
40
|
|
43
41
|
scope :from_datetime, -> (dtstart) {
|
44
|
-
|
45
|
-
where( occurrences: { "$elemMatch" => { :dtstart.gte => dtstart.to_datetime } } )
|
42
|
+
where( occurrences: { "$elemMatch" => Occurence.from_datetime(dtstart).selector } )
|
46
43
|
}
|
47
44
|
|
48
45
|
scope :to_datetime, -> (dtend) {
|
49
|
-
|
50
|
-
where( occurrences: { "$elemMatch" => { :dtend.lte => dtend.to_datetime } } )
|
46
|
+
where( occurrences: { "$elemMatch" => Occurence.to_datetime(dtend).selector } )
|
51
47
|
}
|
52
48
|
end
|
53
49
|
end
|
@@ -17,6 +17,24 @@ module MongoidRecurring
|
|
17
17
|
before_save :set_dtend
|
18
18
|
before_save :adjust_dates_for_all_day
|
19
19
|
|
20
|
+
# ---------------------------------------------------------------------
|
21
|
+
|
22
|
+
scope :for_datetime_range, -> (dtstart, dtend) {
|
23
|
+
dtstart = dtstart.beginning_of_day if dtstart.instance_of?(Date)
|
24
|
+
dtend = dtend.end_of_day if dtend.instance_of?(Date)
|
25
|
+
where( :dtstart.lte => dtend.to_datetime, :dtend.gte => dtstart.to_datetime )
|
26
|
+
}
|
27
|
+
|
28
|
+
scope :from_datetime, -> (dtstart) {
|
29
|
+
dtstart = dtstart.beginning_of_day if dtstart.instance_of?(Date)
|
30
|
+
where( :dtstart.gte => dtstart.to_datetime )
|
31
|
+
}
|
32
|
+
|
33
|
+
scope :to_datetime, -> (dtend) {
|
34
|
+
dtend = dtend.end_of_day if dtend.instance_of?(Date)
|
35
|
+
where( :dtend.lte => dtend.to_datetime )
|
36
|
+
}
|
37
|
+
|
20
38
|
# =====================================================================
|
21
39
|
|
22
40
|
def all_day?
|