Skip to content

Commit c9cef94

Browse files
authored
fix: add "empty" clause for Questionnaire layout (#5637)
**Story card:** [sc-16019](https://app.shortcut.com/simpledotorg/story/16019/sync-is-failing-for-qa-sandbox-and-demo-environments) ## Because Questionnaire sync is broken on this ## This addresses Accounting for the case when the string to be translated is `"empty"` ## Test instructions suite tests
1 parent ad8d369 commit c9cef94

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

app/models/questionnaire.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,12 @@ def localize_layout(sub_layout)
7373
return sub_layout unless text
7474
return sub_layout if text.empty?
7575

76-
sub_layout.merge({"text" => I18n.t!(text)})
76+
translation = if text == "empty"
77+
""
78+
else
79+
I18n.t!(text)
80+
end
81+
sub_layout.merge({"text" => translation})
7782
end
7883

7984
def generate_layout_id(sub_layout)

spec/models/questionnaire_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@
9898
{"text" => "test_translations.test_string"}
9999
]},
100100
{"text" => "test_translations.test_string"},
101-
{"text" => ""}
101+
{"text" => ""},
102+
{"text" => "empty"}
102103
]}
103104

104105
localized_layout = {"item" => [
@@ -108,6 +109,7 @@
108109
{"text" => "Test"}
109110
]},
110111
{"text" => "Test"},
112+
{"text" => ""},
111113
{"text" => ""}
112114
]}
113115

0 commit comments

Comments
 (0)