Skip to content

Commit

Permalink
feat(studies): updates data release other option
Browse files Browse the repository at this point in the history
  • Loading branch information
BenTopping committed Dec 17, 2024
1 parent bac3e8b commit b5e5c4a
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/models/study.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Study < ApplicationRecord # rubocop:todo Metrics/ClassLength
'Other (please specify)'
].freeze

DATA_RELEASE_DELAY_FOR_OTHER = 'other'
DATA_RELEASE_DELAY_FOR_OTHER = 'Other (with free text box)'
DATA_RELEASE_DELAY_REASONS_STANDARD = [
'PhD study',
'Capacity building',
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/metadata/_related_fields.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

var valueFrom = function(element) {
if (element === null) { return null }
var value = element.value.toLowerCase().replace(/[^a-z0-9]+/, '_');
var value = element.value.toLowerCase().replaceAll(/[^a-z0-9]+/g, '_');
return (value.length == 0) ? 'blank' : value;
};

Expand Down
4 changes: 2 additions & 2 deletions features/studies/8447221_data_release_help_text.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Feature: Update the data release fields for creating a study
Scenario Outline: Add help text opposite delay drop down (4044305)
When I choose "<release strategy>" from "What is the data release strategy for this study?"
When I select "delayed" from "How is the data release to be timed?"
When I select "other" from "Reason for delaying release"
When I select "Other (with free text box)" from "Reason for delaying release"
Then I should exactly see "Reason for delaying release"

Examples:
Expand All @@ -41,7 +41,7 @@ Feature: Update the data release fields for creating a study

Scenario Outline: Delaying for 3 months should have the same questions as all other delays (4044273)
When I select "delayed" from "How is the data release to be timed?"
And I select "other" from "Reason for delaying release"
And I select "Other (with free text box)" from "Reason for delaying release"
And I select "<delay_period>" from "Delay for"
And I should exactly see "Comment regarding data release timing and approval"

Expand Down
4 changes: 2 additions & 2 deletions features/studies/data_release_timings.feature
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Feature: Studies have timings for release of their data

Scenario Outline: When the data release is delayed but no reasons are provided
Given I select "delayed" from "How is the data release to be timed?"
And I select "other" from "Reason for delaying release"
And I select "Other (with free text box)" from "Reason for delaying release"
And I fill in "Please explain the reason for delaying release" with "Some reason"
And I select "<period>" from "Delay for"
When I press "Create"
Expand All @@ -54,7 +54,7 @@ Feature: Studies have timings for release of their data

Scenario Outline: When the data release is delayed and the reasons are provided
Given I select "delayed" from "How is the data release to be timed?"
And I select "other" from "Reason for delaying release"
And I select "Other (with free text box)" from "Reason for delaying release"
And I fill in "Please explain the reason for delaying release" with "Some reason"
And I select "<period>" from "Delay for"
And I fill in "Comment regarding data release timing and approval" with "Because it is ok?"
Expand Down
2 changes: 1 addition & 1 deletion features/support/step_definitions/study_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def given_study_metadata(attribute, regexp)
study.update!(
study_metadata_attributes: {
data_release_timing: 'delayed',
data_release_delay_reason: 'other',
data_release_delay_reason: 'Other (with free text box)',
data_release_delay_other_comment: reason,
data_release_delay_period: "#{period} months",
data_release_delay_reason_comment: reason
Expand Down
5 changes: 4 additions & 1 deletion spec/models/study_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,10 @@
create(
:study,
study_metadata:
create(:study_metadata, metadata.merge(data_release_timing: 'delayed', data_release_delay_reason: 'other'))
create(
:study_metadata,
metadata.merge(data_release_timing: 'delayed', data_release_delay_reason: 'Other (with free text box)')
)
)
end

Expand Down

0 comments on commit b5e5c4a

Please sign in to comment.