From 7adcdb1913cbad0d933fdd79c1c316c6776a01a3 Mon Sep 17 00:00:00 2001
From: smmercuri <smercuri@ed.ac.uk>
Date: Fri, 17 May 2024 14:51:45 +0100
Subject: [PATCH] Update default headers based on orientation

---
 stack/cas/castext2/blocks/parsons.block.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/stack/cas/castext2/blocks/parsons.block.php b/stack/cas/castext2/blocks/parsons.block.php
index 7b198b0ab..0d6080a23 100644
--- a/stack/cas/castext2/blocks/parsons.block.php
+++ b/stack/cas/castext2/blocks/parsons.block.php
@@ -219,7 +219,7 @@ class stack_cas_castext2_parsons extends stack_cas_castext2_block {
         if ($proofmode) {
             $code = 'var headers = ["' . stack_string('stackBlock_parsons_used_header') . '"];' . "\n";
         } else {
-            $code = 'var headers = [' . implode(', ', range(1, intval($columns))) . '];' . "\n";
+            $code = 'var headers = [' . implode(', ', range(1, intval($ogcolumns))) . '];' . "\n";
         }
         $code .= 'var available_header = "' . stack_string('stackBlock_parsons_available_header') . '";' . "\n";
 
@@ -237,7 +237,7 @@ class stack_cas_castext2_parsons extends stack_cas_castext2_block {
         
         // More specific pieces of validation
         // Check typing of headers, it should be an array containing strings.
-        $code .= 'if (!(Array.isArray(headers) && headers.every((header) => typeof(header) === "string"))) 
+        $code .= 'if (!(Array.isArray(headers))) 
             {stack_js.display_error("' . stack_string('stackBlock_incorrect_header_type') . '");}' . "\n";
 
         // If the length of headers does not match the number of columns expected throw an error.
-- 
GitLab