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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f507a8ef355ea5e886435e875eb4b0ccbf008cf012d7972649f5e4935bf41de5
4
- data.tar.gz: 7024b73379a62ff0238731320d816f73a9e6f8da9406242b409f68746eb46e35
3
+ metadata.gz: 6dcffdb66f362f836d90369a101b3ca74a90668db617b087f1cc228065ad70f2
4
+ data.tar.gz: 364b4ff338af2fe89ad77b9697a69d1cec6fec8307b8965aed043462d3a58f9d
5
5
  SHA512:
6
- metadata.gz: 1909d123ead543066f6470fc92822dfc44beed19d1b2a49bfed151dda87708b775fd5354c1e260081bdf3bae87cde797e27c789c0113dc0d8879d98e4c0cfef6
7
- data.tar.gz: f641e1ea0473c89c198433431dcefa23bcbc4cb8e31cf535df47e11ed102790ee0fd205dcb5e332dda04c08304d7818d1fe34b6a4292eb79fe8a1a7894613854
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
- def parameterize_slug
42
- self.slug = slug.parameterize.gsub(/(\W|_)/, "-")
43
- end
45
+ def parameterize_slug
46
+ self.slug = slug.parameterize.gsub(/(\W|_)/, "-")
47
+ end
44
48
 
45
- def calendar_time_zone
46
- time_zone || "Etc/UTC"
47
- end
49
+ def calendar_time_zone
50
+ time_zone || "Etc/UTC"
51
+ end
48
52
 
49
- def calendar_start_time
50
- if all_day?
51
- Icalendar::Values::DateOrDateTime.new(start_date_string, tzid: calendar_time_zone).call
52
- else
53
- Icalendar::Values::DateOrDateTime.new(start_time, tzid: calendar_time_zone)
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
- def calendar_end_time
58
- if all_day?
59
- Icalendar::Values::DateOrDateTime.new(end_date_string, tzid: calendar_time_zone).call
60
- else
61
- Icalendar::Values::DateOrDateTime.new(end_time, tzid: calendar_time_zone)
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
- def start_date_string
66
- start_time.strftime("%Y%m%d")
67
- end
69
+ def start_date_string
70
+ start_time.strftime("%Y%m%d")
71
+ end
68
72
 
69
- def end_date_string
70
- end_time.strftime("%Y%m%d")
71
- end
73
+ def end_date_string
74
+ end_time.strftime("%Y%m%d")
75
+ end
72
76
  end
73
77
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MrCommon
4
- VERSION = "3.0.0"
4
+ VERSION = "3.1.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mr_common
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corey Smedstad