From f5c9742b421c7c28972d2ea6b21842ef71cae297 Mon Sep 17 00:00:00 2001
From: Marten Veldthuis <marten@veldthuis.com>
Date: Wed, 24 Mar 2021 15:29:04 +0100
Subject: [PATCH] Fix QubyProxy for nil titles

---
 CHANGELOG.md                             |  4 ++++
 Gemfile.lock                             |  6 +++---
 lib/quby/compiler/services/quby_proxy.rb | 12 ++++++------
 lib/quby/compiler/version.rb             |  2 +-
 4 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 609d544..bed2f17 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+# 0.3.2
+
+* Fix slashes-after-numbers removal when question does not have a title
+
 # 0.3.1
 
 * Slashes after numbers are now removed from question titles when making RoQua seeds (quests attribute).
diff --git a/Gemfile.lock b/Gemfile.lock
index 4015683..ce1c15a 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,7 +1,7 @@
 PATH
   remote: .
   specs:
-    quby-compiler (0.3.1)
+    quby-compiler (0.3.2)
       actionview (>= 5.0)
       activemodel (>= 5.0)
       activesupport (>= 5.0)
@@ -74,10 +74,10 @@ GEM
     mini_portile2 (2.5.0)
     minitest (5.14.4)
     naught (1.1.0)
-    nokogiri (1.11.1)
+    nokogiri (1.11.2)
       mini_portile2 (~> 2.5.0)
       racc (~> 1.4)
-    nokogumbo (2.0.4)
+    nokogumbo (2.0.5)
       nokogiri (~> 1.8, >= 1.8.4)
     pry (0.13.1)
       coderay (~> 1.1)
diff --git a/lib/quby/compiler/services/quby_proxy.rb b/lib/quby/compiler/services/quby_proxy.rb
index d9c0a55..d3f7c61 100644
--- a/lib/quby/compiler/services/quby_proxy.rb
+++ b/lib/quby/compiler/services/quby_proxy.rb
@@ -292,19 +292,19 @@ module Quby
 
         def strip_question_number_slashes(quests)
           quests.transform_values! do |value|
-            value.gsub /^(\s*\d+)\\/, '\1'
+            value&.gsub /^(\s*\d+)\\/, '\1'
           end
         end
 
         def process_scores
           scores_from_schemas
         end
-      
+
         def scores_from_schemas
           score_headers = [] # headers outcome (humanized name for subscores)
           score_keys    = [] # headers data-export (not all of it, just the score_subscore part, shortened)
           score_labels  = [] # score names outcome (humanized name for score as a whole)
-      
+
           questionnaire.score_schemas.values.each do |score_schema|
             score_labels << score_schema.label
             score_keys << score_schema.subscore_schemas.map do |subschema|
@@ -318,18 +318,18 @@ module Quby
                 hash
               end
             end
-      
+
             headers = score_schema.subscore_schemas.map(&:label)
             score_headers += headers - score_headers
           end
-      
+
           {
             headers: score_headers,
             keys: score_keys,
             labels: score_labels
           }
         end
-      
+
         class ShortenKeysUniq
           def initialize
             @seen_results = []
diff --git a/lib/quby/compiler/version.rb b/lib/quby/compiler/version.rb
index a744ba1..0dbb974 100644
--- a/lib/quby/compiler/version.rb
+++ b/lib/quby/compiler/version.rb
@@ -1,5 +1,5 @@
 module Quby
   module Compiler
-    VERSION = "0.3.1"
+    VERSION = "0.3.2"
   end
 end
-- 
GitLab