-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issues with Conditional question serialization (offered by @briri
from DMPTool). Based on DMPtool commit CDLUC3#667. Changes proposed in this PR (text from cited PR): Run SQL script to convert existing records in the conditions table so that they are JSON Arrays (see query below) Updated the form partials in app/views/org_admin/conditions/_form.erb.rb to properly send condition data to the controller. Removed all JSON.parse calls in the app/helpers/conditions.rb helper Made the following changes to simplify this patch and to make it a little more user friendly: The "Add Conditions" button will now say "Edit Conditions" if there are any. Updated the column heading over the "thing that happens when the condition is met" from "Remove" to "Target" since the content of the column can either be questions being removed or an email notification being sent. Conditions can be added or removed (not updated anymore) Hovering over the email of an existing condition displays a tooltip that shows the email message, subject, etc. Needed to update underlying data within the table so that they are JSON arrays using MySQL or Postgres scripts in db/migrate-sql-scripts folder: 20241219_UpdateConditions-MySql.sql.txt 20241219_UpdateConditions-Postgres.sql.txt (Note. The scripts have .txt endings to be able to get round .sql in .gitignore.)
- Loading branch information
John Pinto
committed
Jan 20, 2025
1 parent
994bb60
commit c2cb3d0
Showing
10 changed files
with
285 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
db/migrate-sql-scripts/20241219_UpdateConditions-MySql.sql.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
UPDATE conditions | ||
SET | ||
option_list = CONCAT ( | ||
CONCAT ( | ||
'[', | ||
REPLACE ( | ||
REPLACE ( | ||
REPLACE (option_list, '---\n- \'', '"'), | ||
'\'\n- \'', | ||
'","' | ||
), | ||
'\'\n', | ||
'"' | ||
) | ||
), | ||
']' | ||
), | ||
remove_data = CONCAT ( | ||
CONCAT ( | ||
'[', | ||
REPLACE ( | ||
REPLACE ( | ||
REPLACE (remove_data, '---\n- \'', '"'), | ||
'\'\n- \'', | ||
'","' | ||
), | ||
'\'\n', | ||
'"' | ||
) | ||
), | ||
']' | ||
) | ||
where | ||
option_list like '---%'; |
Oops, something went wrong.