Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## V4.1.2 or V4.2.0

### Fixed
- Fixed rubocop errors after V4.1.1 release
## V4.1.1

### Added
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/plan_exports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,6 @@ def export_params
# in html that break docx creation by htmltoword gem.
def clean_html_for_docx_creation(html)
# Replaces single backslash \ with \\ with gsub.
html.gsub(/\\/, '\&\&')
html.gsub('\\', '\&\&')
end
end
6 changes: 3 additions & 3 deletions app/helpers/customizable_template_link_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ def link_to_customizable_template(name, customization, template)

if customization.present?
if customization.created_at < template.created_at
name = name.blank? ? _('Transfer customisation') : name
name = _('Transfer customisation') if name.blank?
link_to name,
org_admin_template_customization_transfers_path(customization.id),
data: { method: 'post' }
else
name = name.blank? ? _('Edit customisation') : name
name = _('Edit customisation') if name.blank?
link_to name, org_admin_template_path(id: customization.id)
end
else
name = name.blank? ? _('Customise') : name
name = _('Customise') if name.blank?
link_to name,
org_admin_template_customizations_path(template.id),
'data-method': 'post'
Expand Down
2 changes: 1 addition & 1 deletion app/models/answer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def answered?
#
# Returns Array
def non_archived_notes
notes.select { |n| n.archived.blank? }.sort! { |x, y| x.created_at <=> y.created_at }
notes.select { |n| n.archived.blank? }.sort_by!(&:created_at)
end

# The parsed JSON hash for the current answer object. Generates a new hash if none
Expand Down
2 changes: 1 addition & 1 deletion app/models/exported_plan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def as_txt(sections, unanswered_questions, question_headings, details)
next if answer.nil? && !unanswered_questions

if question_headings
qtext = sanitize_text(question.text.gsub(/<li>/, ' * '))
qtext = sanitize_text(question.text.gsub('<li>', ' * '))
output += "\n* #{qtext}"
end
if answer.nil?
Expand Down
8 changes: 4 additions & 4 deletions app/models/plan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ def complete_feedback(org_admin)
#
# Returns Boolean
def editable_by?(user_id)
roles.select { |r| r.user_id == user_id && r.active && r.editor }.any?
roles.any? { |r| r.user_id == user_id && r.active && r.editor }
end

##
Expand Down Expand Up @@ -409,7 +409,7 @@ def readable_by?(user_id)
#
# Returns Boolean
def commentable_by?(user_id)
roles.select { |r| r.user_id == user_id && r.active && r.commenter }.any? ||
roles.any? { |r| r.user_id == user_id && r.active && r.commenter } ||
reviewable_by?(user_id)
end

Expand All @@ -419,7 +419,7 @@ def commentable_by?(user_id)
#
# Returns Boolean
def administerable_by?(user_id)
roles.select { |r| r.user_id == user_id && r.active && r.administrator }.any?
roles.any? { |r| r.user_id == user_id && r.active && r.administrator }
end

# determines if the plan is reviewable by the specified user
Expand Down Expand Up @@ -539,7 +539,7 @@ def num_questions
#
# Returns Boolean
def visibility_allowed?
!is_test? && phases.select { |phase| phase.visibility_allowed?(self) }.any?
!is_test? && phases.any? { |phase| phase.visibility_allowed?(self) }
end

# Determines whether or not a question (given its id) exists for the self plan
Expand Down
2 changes: 1 addition & 1 deletion app/models/question.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def deep_copy(**options)
copy = dup
copy.modifiable = options.fetch(:modifiable, modifiable)
copy.section_id = options.fetch(:section_id, nil)
copy.save!(validate: false) if options.fetch(:save, false)
copy.save!(validate: false) if options.fetch(:save, false)
options[:question_id] = copy.id
question_options.each { |qo| copy.question_options << qo.deep_copy(**options) }
annotations.each do |annotation|
Expand Down
7 changes: 3 additions & 4 deletions lib/csvable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ module Csvable
require 'csv'
class << self
# rubocop:disable Style/OptionalBooleanParameter
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
# rubocop:disable Metrics/AbcSize
def from_array_of_hashes(data = [], humanize = true, sep = ',')
return '' unless data.first&.keys

headers = if humanize
data.first.keys
.map(&:to_s)
.map(&:humanize)
.map { |x| x.to_s.humanize }
else
data.first.keys
.map(&:to_s)
Expand All @@ -27,6 +26,6 @@ def from_array_of_hashes(data = [], humanize = true, sep = ',')
end
end
# rubocop:enable Style/OptionalBooleanParameter
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
# rubocop:enable Metrics/AbcSize
end
end
2 changes: 1 addition & 1 deletion lib/tasks/upgrade.rake
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ namespace :upgrade do

orgs.each do |org|
# If the Org already has a ROR identifier skip it
next if org.identifiers.select { |id| id.identifier_scheme_id == ror.id }.any?
next if org.identifiers.any? { |id| id.identifier_scheme_id == ror.id }

# The abbreviation sometimes causes weird results so strip it off
# in this instance
Expand Down
2 changes: 1 addition & 1 deletion spec/support/helpers/identifier_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def orcid_scheme
end

def append_prefix(scheme:, val:)
val = val.start_with?('/') ? val[1..val.length] : val
val = val[1..val.length] if val.start_with?('/')
url = landing_page_for(scheme: scheme)
val.start_with?(url) ? val : "#{url}#{val}"
end
Expand Down