mr_common 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/mr_common/reminder.rb +29 -25
- data/lib/mr_common/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6dcffdb66f362f836d90369a101b3ca74a90668db617b087f1cc228065ad70f2
|
4
|
+
data.tar.gz: 364b4ff338af2fe89ad77b9697a69d1cec6fec8307b8965aed043462d3a58f9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6829a93ddd80d2e88b0cb3f3714225b21c6217f5bce3ae8175893b28f2dc1206ce68b3cbbd2d85594b6c124706dbe620dbbc30cb72211d560f2c1a12e3c17c4
|
7
|
+
data.tar.gz: 6fa7f34f7baecc575391e796f8b94504dfd0b1341f5b1914250dca43be253de02d70f61ed402ee95a01b20a060bb186699615a74377e615a4517babf73d8df8f
|
@@ -13,7 +13,6 @@ module MrCommon
|
|
13
13
|
validates :location, presence: true
|
14
14
|
validates :summary, presence: true
|
15
15
|
validates :slug, presence: true, uniqueness: true
|
16
|
-
validates :start_time, presence: true
|
17
16
|
validates :all_day, inclusion: [true, false]
|
18
17
|
validates :time_zone, presence: true, inclusion: MrCommon::Timezone.time_zone_options, if: -> { time_zone.present? }
|
19
18
|
|
@@ -36,38 +35,43 @@ module MrCommon
|
|
36
35
|
cal.to_ical
|
37
36
|
end
|
38
37
|
|
38
|
+
def self.search(q)
|
39
|
+
qy = "%#{q}%"
|
40
|
+
Reminder.where("summary ilike ? or description ilike ? or project_number ilike ?", qy, qy, qy)
|
41
|
+
end
|
42
|
+
|
39
43
|
private
|
40
44
|
|
41
|
-
|
42
|
-
|
43
|
-
|
45
|
+
def parameterize_slug
|
46
|
+
self.slug = slug.parameterize.gsub(/(\W|_)/, "-")
|
47
|
+
end
|
44
48
|
|
45
|
-
|
46
|
-
|
47
|
-
|
49
|
+
def calendar_time_zone
|
50
|
+
time_zone || "Etc/UTC"
|
51
|
+
end
|
48
52
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
end
|
53
|
+
def calendar_start_time
|
54
|
+
if all_day?
|
55
|
+
Icalendar::Values::Date.new(Date.parse(start_date_string), tzid: calendar_time_zone)
|
56
|
+
else
|
57
|
+
Icalendar::Values::DateOrDateTime.new(start_time, tzid: calendar_time_zone)
|
55
58
|
end
|
59
|
+
end
|
56
60
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
end
|
61
|
+
def calendar_end_time
|
62
|
+
if all_day?
|
63
|
+
Icalendar::Values::Date.new(Date.parse(end_date_string) + 1, tzid: calendar_time_zone)
|
64
|
+
else
|
65
|
+
Icalendar::Values::DateOrDateTime.new(end_time, tzid: calendar_time_zone)
|
63
66
|
end
|
67
|
+
end
|
64
68
|
|
65
|
-
|
66
|
-
|
67
|
-
|
69
|
+
def start_date_string
|
70
|
+
start_time.strftime("%Y%m%d")
|
71
|
+
end
|
68
72
|
|
69
|
-
|
70
|
-
|
71
|
-
|
73
|
+
def end_date_string
|
74
|
+
end_time.strftime("%Y%m%d")
|
75
|
+
end
|
72
76
|
end
|
73
77
|
end
|
data/lib/mr_common/version.rb
CHANGED