File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
app/lib/mavis_cli/reporting_api Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change 3
3
module MavisCLI
4
4
module ReportingAPI
5
5
class UpdateVaccinationEvents < Dry ::CLI ::Command
6
- desc "Update ReportingAPI Vaccination Events"
6
+ desc <<-DESC
7
+
8
+ Update ReportingAPI Vaccination Events for all VaccinationRecords created after a given DateTime.
9
+ DateTimes can be given in any format parsable by Time.parse.
10
+ Defaults to one year ago.
11
+ DESC
12
+
7
13
option :from ,
8
- desc :
9
- "Only consider vaccination records created after this time (any format parsable by Time.parse())" ,
14
+ desc : "Only consider vaccination records created after this time" ,
10
15
type : :string ,
11
16
optional : true ,
12
- aliases : %w[ -f - -from] ,
13
- default : ( Time . zone . now - 365 ) . iso8601
17
+ aliases : %w[ --from ] ,
18
+ default : nil
14
19
15
- def call ( from :, **)
20
+ def call ( from : nil , **)
16
21
MavisCLI . load_rails
17
22
18
- min_datetime = Time . zone . parse ( from )
23
+ min_datetime = from ? Time . zone . parse ( from ) : ( Time . zone . now - 1 . year )
19
24
20
25
records = VaccinationRecord . where ( "created_at > ?" , min_datetime )
21
26
puts "#{ records . count } VaccinationRecords created since #{ min_datetime . iso8601 } "
You can’t perform that action at this time.
0 commit comments