[obs-commits] [openSUSE/open-build-service] d1b986: Refactor conversion of current time in project mon...
Branch: refs/heads/depfu/update/srcapi/rubocop-0.60.0 Home: https://github.com/openSUSE/open-build-service Commit: d1b98629c1132149623da8a3531c2a619f0410df https://github.com/openSUSE/open-build-service/commit/d1b98629c1132149623da8... Author: Björn Geuken <bgeuken@suse.de> Date: 2018-10-30 (Tue, 30 Oct 2018) Changed paths: M src/api/app/views/webui/project/monitor.html.erb M src/api/app/views/webui/project/refresh_monitor.html.erb Log Message: ----------- Refactor conversion of current time in project monitor page We've been fetching the 'DateTime' and afterwards did some string replacement which made the produced string look (almost) identical[*] to what 'Time.now.to_s' would produce. Instead of doing all that we now just use 'Time.now'. Time.now.to_s: "2018-10-30 13:25:52 +0000" DateTime.now.to_s.sub('T', ' '): "2018-10-30 13:26:11+00:00" The change itself was needed / demanded by Rubocop: https://github.com/rubocop-hq/ruby-style-guide#date--time Commit: 7a119e6bad1208ab76b310a6bc1c480791941a1e https://github.com/openSUSE/open-build-service/commit/7a119e6bad1208ab76b310... Author: Björn Geuken <bgeuken@suse.de> Date: 2018-10-30 (Tue, 30 Oct 2018) Changed paths: M src/api/app/jobs/project_create_auto_cleanup_requests.rb M src/api/app/models/branch_package.rb M src/api/app/models/bs_request.rb M src/api/spec/features/webui/requests_spec.rb Log Message: ----------- Use Time.now for auto accept / auto cleanup Active Record internally converts the time accept_at string to datetime which means we can safely use Time.now (the produced request xml does not change). Also the conversion and comparison of Time and DateTime is still working after this change. The change itself was needed / demanded by Rubocop: https://github.com/rubocop-hq/ruby-style-guide#date--time Commit: 3aef6d912eb3a1566fe0bf05744c385c4f287b2a https://github.com/openSUSE/open-build-service/commit/3aef6d912eb3a1566fe0bf... Author: Björn Geuken <bgeuken@suse.de> Date: 2018-10-30 (Tue, 30 Oct 2018) Changed paths: M src/api/app/models/bs_request.rb Log Message: ----------- Use Time.now when comparing times Rubocop prefers using 'Time.now' over 'DateTime.now'[*]. Since comparing objects of both classes works as expected, it's safe to change this. [*] https://github.com/rubocop-hq/ruby-style-guide#date--time Compare: https://github.com/openSUSE/open-build-service/compare/ca510f6c64db...3aef6d... **NOTE:** This service has been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/ Functionality will be removed from GitHub.com on January 31st, 2019.
participants (1)
-
Björn Geuken