Skip to content

Commit ca5209c

Browse files
committed
modify qsf to compare only for display logic
1 parent 91fc21e commit ca5209c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

facebook/qsf-tools/qsf-differ.R

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,19 @@ diff_question <- function(names, change_type=c("Choices", "QuestionText",
264264

265265
changed <- list()
266266
for (question in names) {
267-
if ( !identical(old_qsf[[question]][[change_type]], new_qsf[[question]][[change_type]]) ) {
267+
old_contents <- old_qsf[[question]][[change_type]]
268+
new_contents <- new_qsf[[question]][[change_type]]
269+
270+
if (change_type == "DisplayLogic") {
271+
# Ignore in-page status.
272+
old_contents[["inPage"]] <- "FALSE"
273+
new_contents[["inPage"]] <- "FALSE"
274+
275+
# Sort items by name for more robust comparison.
276+
old_contents <- old_contents[names(old_contents) %>% sort()]
277+
new_contents <- new_contents[names(new_contents) %>% sort()]
278+
}
279+
if ( !identical(old_contents, new_contents) ) {
268280
changed_subquestions <- c()
269281
if (change_type == "Subquestions") {
270282
subquestion_codes <- unique(

0 commit comments

Comments
 (0)