Skip to content

Commit

Permalink
Solve Style/DateTime rubocop offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarcoux committed Nov 5, 2018
1 parent 4309ed5 commit 63ed40d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/api/app/controllers/request_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def request_command_setincident
end

def request_command_setacceptat
time = DateTime.parse(params[:time]) if params[:time].present?
time = Time.parse(params[:time]) if params[:time].present?
@req.set_accept_at!(time)
render_ok
end
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/jobs/project_create_auto_cleanup_requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def autoclean_project(prj)
begin
attribute = prj.attribs.find_by_attrib_type_id(@cleanup_attribute.id)
return unless attribute
time = DateTime.parse(attribute.values.first.value)
time = Time.parse(attribute.values.first.value)
return unless time
rescue ArgumentError
# not parseable time
Expand Down
4 changes: 2 additions & 2 deletions src/api/app/models/binary_release.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def self.update_binary_releases_via_json(repository, json, time = Time.now)
# complete hash for new entry
hash[:binary_releasetime] = time
hash[:binary_buildtime] = nil
hash[:binary_buildtime] = DateTime.strptime(binary['buildtime'].to_s, '%s') if binary['buildtime'].present?
hash[:binary_buildtime] = Time.strptime(binary['buildtime'].to_s, '%s') if binary['buildtime'].present?
hash[:binary_disturl] = binary['disturl']
hash[:binary_supportstatus] = binary['supportstatus']
if binary['updateinfoid']
Expand Down Expand Up @@ -204,7 +204,7 @@ def reset_cache
def indentical_to?(binary_hash)
binary_disturl == binary_hash['disturl'] &&
binary_supportstatus == binary_hash['supportstatus'] &&
binary_buildtime == DateTime.strptime(binary_hash['buildtime'].to_s, '%s')
binary_buildtime == Time.strptime(binary_hash['buildtime'].to_s, '%s')
end
#### Alias of methods
end
Expand Down
4 changes: 2 additions & 2 deletions src/api/app/models/bs_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def self.new_from_hash(hashed)
hashed.delete('description')

str = hashed.value('accept_at')
request.accept_at = DateTime.parse(str) if str
request.accept_at = Time.parse(str) if str
hashed.delete('accept_at')
raise SaveError, 'Auto accept time is in the past' if request.accept_at && request.accept_at < Time.now

Expand Down Expand Up @@ -567,7 +567,7 @@ def changestate_accepted(opts)
v = attrib.values.first if attrib
if defined?(v) && v
begin
embargo = DateTime.parse(v.value)
embargo = Time.parse(v.value)
if /^\d{4}-\d\d?-\d\d?$/.match?(v.value)
# no time specified, allow it next day
embargo = embargo.tomorrow
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/models/cloud/backend/upload_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def self.all(user, options = {})
end

def created
Time.at(xml_object.created.to_i).to_datetime
Time.at(xml_object.created.to_i)
end
alias_method :created_at, :created

Expand Down

0 comments on commit 63ed40d

Please sign in to comment.