Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
RDMS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
researchdata
RDMS
Commits
6569d85e
Commit
6569d85e
authored
9 months ago
by
Gyan Gupta
Browse files
Options
Downloads
Patches
Plain Diff
write a rake task to make title same as s3_folder_name
parent
23c02172
Branches
changes/revoke-sanitizaton-of-title
No related tags found
1 merge request
!316
Revoke sanitizaton of title
Pipeline
#15429
passed
9 months ago
Stage: build
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hyrax/app/helpers/complex_helper.rb
+4
-1
4 additions, 1 deletion
hyrax/app/helpers/complex_helper.rb
hyrax/lib/tasks/make_title_as_s3_folder_name.rake
+32
-0
32 additions, 0 deletions
hyrax/lib/tasks/make_title_as_s3_folder_name.rake
with
36 additions
and
1 deletion
hyrax/app/helpers/complex_helper.rb
+
4
−
1
View file @
6569d85e
module
ComplexHelper
def
sanitize_title
(
title
)
return
if
title
.
nil?
# remove extra spaces from beginning and end
title
=
title
.
strip
# Remove any forward slash and backslash characters
title
.
gsub!
(
/[\/\\]/
,
''
)
...
...
This diff is collapsed.
Click to expand it.
hyrax/lib/tasks/make_title_as_s3_folder_name.rake
0 → 100644
+
32
−
0
View file @
6569d85e
namespace
:rdms
do
desc
"Make title as s3 folder name. usage: rdms:make_title_as_s3_folder_name"
task
make_title_as_s3_folder_name: :environment
do
changed_subjects
=
[]
changed_sessions
=
[]
changed_modalities
=
[]
ComplexSubject
.
find_each
do
|
subject
|
if
subject
.
subject_title
!=
subject
.
s3_folder_name
subject
.
update
(
subject_title:
subject
.
s3_folder_name
)
changed_subjects
<<
subject
.
id
end
end
ComplexSession
.
find_each
do
|
session
|
if
session
.
session_title
!=
session
.
s3_folder_name
session
.
update
(
session_title:
session
.
s3_folder_name
)
changed_sessions
<<
session
.
id
end
end
ComplexModality
.
find_each
do
|
modality
|
if
modality
.
modality_title
!=
modality
.
s3_folder_name
modality
.
update
(
modality_title:
modality
.
s3_folder_name
)
changed_modalities
<<
modality
.
id
end
end
puts
"These Subjects modified:
#{
changed_subjects
}
"
puts
"These Sessions modified:
#{
changed_sessions
}
"
puts
"These Modalities modified:
#{
changed_modalities
}
"
end
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment