Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Carriage Return Issue When Uploading db fields to translation.io #523

Closed
aaronskiba opened this issue Nov 3, 2023 · 3 comments · Fixed by #524
Closed

Carriage Return Issue When Uploading db fields to translation.io #523

aaronskiba opened this issue Nov 3, 2023 · 3 comments · Fixed by #524
Assignees

Comments

@aaronskiba
Copy link
Collaborator

aaronskiba commented Nov 3, 2023

Please complete the following fields as applicable:

What version of the DMPRoadmap code are you running? (e.g. v2.2.0)
3.3.1+portage-3.2.1

Issue
Until recently (10 days ago), when syncing db fields to translation.io, \r characters present in db fields would not be present in the uploaded translation.io entries. However, now the \r characters are present in uploaded translation.io strings. As a result, many translations are breaking.

It seems that the \r character has always been present in the db entries. However, until recently, the \r characters would not be present in the translation.io entries.

Example

  • All Annotation.text entries with this substring include \r:
2.7.6 :012 > annotations = Annotation.where('text LIKE ?','%<li>Will someone who is unfamiliar with the project%')
  Annotation Load (42.8ms)  SELECT  "annotations".* FROM "annotations" WHERE (text LIKE '%<li>Will someone who is unfamiliar with the project%') LIMIT $1  [["LIMIT", 11]]
 => #<ActiveRecord::Relation [#<Annotation id: 70428, question_id: 74478, org_id: 406, text: "<ul>\r\n<li>Will someone who is unfamilia... 
2.7.6 :013 > annotations.count
   (41.4ms)  SELECT COUNT(*) FROM "annotations" WHERE (text LIKE '%<li>Will someone who is unfamiliar with the project%')
 => 5 
2.7.6 :014 > annotations.where('text LIKE ?','%\r%').count
   (45.4ms)  SELECT COUNT(*) FROM "annotations" WHERE (text LIKE '%<li>Will someone who is unfamiliar with the project%') AND (text LIKE '%\r%')
 => 5 
2.7.6 :015 > 
  • This entry exists in the db, both with and without the \r characters:
    Screenshot from 2023-11-03 15-47-06
  • The version with \r characters is only 10 days old:
    Screenshot from 2023-11-03 15-46-15
  • But the entry has existed in the db since January 2023:
    Screenshot from 2023-11-03 15-49-32
@aaronskiba
Copy link
Collaborator Author

Same behaviour exists in staging:
Screenshot from 2023-11-03 12-43-46

@aaronskiba
Copy link
Collaborator Author

Searched 1-year through translation.io history. The oldest entry with \r is 9 days old:
Screenshot from 2023-11-03 14-45-47
Screenshot from 2023-11-03 14-46-12

@aaronskiba aaronskiba changed the title Carriage Return Issue With Template.Phase Field Carriage Return Issue When Uploading db fields to translation.io Nov 3, 2023
@aaronskiba
Copy link
Collaborator Author

DB FIELDS WITH \r ENTRIES ALONG WITH COUNTS

2.7.6 :027 > Template.where('description LIKE ?', "%\r%").count
%')(2.3ms)  SELECT COUNT(*) FROM "templates" WHERE (description LIKE '%
 => 52 
2.7.6 :028 > Phase.where('description LIKE ?', "%\r%").count
%')(1.9ms)  SELECT COUNT(*) FROM "phases" WHERE (description LIKE '%
 => 143 
2.7.6 :029 > Section.where('description LIKE ?', "%\r%").count
%')(7.1ms)  SELECT COUNT(*) FROM "sections" WHERE (description LIKE '%
 => 474 
 2.7.6 :030 > Question.where('text LIKE ?', "%\r%").count
%')(41.7ms)  SELECT COUNT(*) FROM "questions" WHERE (text LIKE '%
 => 7805 
 2.7.6 :031 > Question.where('default_value LIKE ?', "%\r%").count
%')(6.5ms)  SELECT COUNT(*) FROM "questions" WHERE (default_value LIKE '%
 => 387 
 2.7.6 :032 > Annotation.where('text LIKE ?', "%\r%").count
%')(30.9ms)  SELECT COUNT(*) FROM "annotations" WHERE (text LIKE '%
 => 33036 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants