From 2e7b38b03a3a484e1bf1254a324868460b7e0b2c Mon Sep 17 00:00:00 2001 From: satvik-tha-god Date: Fri, 10 Jun 2022 20:17:49 +0530 Subject: [PATCH 01/16] [instrument_builder] ADDED: field warnings for maxLength in Instrument Builder --- .../instrument_builder/jsx/react.questions.js | 70 ++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) diff --git a/modules/instrument_builder/jsx/react.questions.js b/modules/instrument_builder/jsx/react.questions.js index a7c3cc1a63b..0dfff4d366c 100644 --- a/modules/instrument_builder/jsx/react.questions.js +++ b/modules/instrument_builder/jsx/react.questions.js @@ -996,12 +996,80 @@ class AddElement extends Component { }); } + if(questionName.length > 64 && selected !== 'textbox' && selected !== 'textarea' && + selected !== 'date' && selected !== 'numeric') { + // Error, question name is needed for the desired type. Set the element + // error flag for the questionName with message. Set the hasError flag + let temp = (this.state.error) ? this.state.error : {}; + temp.questionName = 'Field length should be strictly less than 65 characters'; + this.setState({ + error: temp, + }); + hasError = true; + } else if (this.state.error) { + // No error, remove the elememt's questionName error flag if set + let temp = this.state.error; + delete temp.questionName; + this.setState({ + error: temp, + }); + } + if (hasError) { + // An error is present, return + return; + } + + if(questionText.length > 64) { + // Error, question name is needed for the desired type. Set the element + // error flag for the questionText with message. Set the hasError flag + let temp = (this.state.error) ? this.state.error : {}; + temp.questionText = 'Field length should be strictly less than 65 characters'; + this.setState({ + error: temp, + }); + hasError = true; + } else if (this.state.error) { + // No error, remove the elememt's questionText error flag if set + let temp = this.state.error; + delete temp.questionText; + this.setState({ + error: temp, + }); + } + if (hasError) { + // An error is present, return + return; + } + + if(questionName.length > 57 && (selected === 'textbox' || selected === 'textarea' || + selected === 'date' || selected === 'numeric')) { + // Error, question name is needed for the desired type. Set the element + // error flag for the questionName with message. Set the hasError flag + let temp = (this.state.error) ? this.state.error : {}; + temp.questionName = 'Field length should be strictly less than 58 characters'; + this.setState({ + error: temp, + }); + hasError = true; + } else if (this.state.error) { + // No error, remove the elememt's questionName error flag if set + let temp = this.state.error; + delete temp.questionName; + this.setState({ + error: temp, + }); + } + if (hasError) { + // An error is present, return + return; + } + if (questionName === '' && selected !== 'header' && selected !== 'label' && selected !== 'line' && selected !== 'page-break') { // Error, question name is needed for the desired type. Set the element // error flag for the questionName with message. Set the hasError flag let temp = (this.state.error) ? this.state.error : {}; - temp.questionName = 'Must specifiy name for database to save value into'; + temp.questionName = 'Must specify name for database to save value into'; this.setState({ error: temp, }); From 4d8fbbe93db8a0b8071ae3532a8359ceda7fba75 Mon Sep 17 00:00:00 2001 From: Satvik Singh <64309880+satvik-tha-god@users.noreply.github.com> Date: Tue, 14 Jun 2022 12:51:51 +0530 Subject: [PATCH 02/16] Update modules/instrument_builder/jsx/react.questions.js Co-authored-by: christinerogers --- modules/instrument_builder/jsx/react.questions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/instrument_builder/jsx/react.questions.js b/modules/instrument_builder/jsx/react.questions.js index 0dfff4d366c..9b428c3c159 100644 --- a/modules/instrument_builder/jsx/react.questions.js +++ b/modules/instrument_builder/jsx/react.questions.js @@ -1001,7 +1001,7 @@ class AddElement extends Component { // Error, question name is needed for the desired type. Set the element // error flag for the questionName with message. Set the hasError flag let temp = (this.state.error) ? this.state.error : {}; - temp.questionName = 'Field length should be strictly less than 65 characters'; + temp.questionName = 'Please shorten to 64 characters maximum'; this.setState({ error: temp, }); From e8ba5b324ce428bc8d668f4109a1b11123d46e7e Mon Sep 17 00:00:00 2001 From: Satvik Singh <64309880+satvik-tha-god@users.noreply.github.com> Date: Tue, 14 Jun 2022 12:52:09 +0530 Subject: [PATCH 03/16] Update modules/instrument_builder/jsx/react.questions.js Co-authored-by: christinerogers --- modules/instrument_builder/jsx/react.questions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/instrument_builder/jsx/react.questions.js b/modules/instrument_builder/jsx/react.questions.js index 9b428c3c159..f0f97c4d68d 100644 --- a/modules/instrument_builder/jsx/react.questions.js +++ b/modules/instrument_builder/jsx/react.questions.js @@ -1007,7 +1007,7 @@ class AddElement extends Component { }); hasError = true; } else if (this.state.error) { - // No error, remove the elememt's questionName error flag if set + // No error, remove the element's questionName error flag if set let temp = this.state.error; delete temp.questionName; this.setState({ From 418fce126c5fde733eed52ec89a97895013ccb3f Mon Sep 17 00:00:00 2001 From: Satvik Singh <64309880+satvik-tha-god@users.noreply.github.com> Date: Tue, 14 Jun 2022 12:52:23 +0530 Subject: [PATCH 04/16] Update modules/instrument_builder/jsx/react.questions.js Co-authored-by: christinerogers --- modules/instrument_builder/jsx/react.questions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/instrument_builder/jsx/react.questions.js b/modules/instrument_builder/jsx/react.questions.js index f0f97c4d68d..67280b6139b 100644 --- a/modules/instrument_builder/jsx/react.questions.js +++ b/modules/instrument_builder/jsx/react.questions.js @@ -1023,7 +1023,7 @@ class AddElement extends Component { // Error, question name is needed for the desired type. Set the element // error flag for the questionText with message. Set the hasError flag let temp = (this.state.error) ? this.state.error : {}; - temp.questionText = 'Field length should be strictly less than 65 characters'; + temp.questionText = 'Please shorten to 64 characters maximum'; this.setState({ error: temp, }); From d2a41c2b00ab10a44c6257b0faa06744fa17c2f1 Mon Sep 17 00:00:00 2001 From: Satvik Singh <64309880+satvik-tha-god@users.noreply.github.com> Date: Tue, 14 Jun 2022 12:52:34 +0530 Subject: [PATCH 05/16] Update modules/instrument_builder/jsx/react.questions.js Co-authored-by: christinerogers --- modules/instrument_builder/jsx/react.questions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/instrument_builder/jsx/react.questions.js b/modules/instrument_builder/jsx/react.questions.js index 67280b6139b..dfa6d91a7eb 100644 --- a/modules/instrument_builder/jsx/react.questions.js +++ b/modules/instrument_builder/jsx/react.questions.js @@ -1046,7 +1046,7 @@ class AddElement extends Component { // Error, question name is needed for the desired type. Set the element // error flag for the questionName with message. Set the hasError flag let temp = (this.state.error) ? this.state.error : {}; - temp.questionName = 'Field length should be strictly less than 58 characters'; + temp.questionName = 'Please shorten to 57 characters maximum'; this.setState({ error: temp, }); From 94af55c48442bf7b201383c1a95b78d14f4eca2c Mon Sep 17 00:00:00 2001 From: Satvik Singh <64309880+satvik-tha-god@users.noreply.github.com> Date: Tue, 14 Jun 2022 13:07:19 +0530 Subject: [PATCH 06/16] [instrument_builder][FIX] LORIS Test suite warnings --- modules/instrument_builder/jsx/react.questions.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/instrument_builder/jsx/react.questions.js b/modules/instrument_builder/jsx/react.questions.js index dfa6d91a7eb..8137567bf76 100644 --- a/modules/instrument_builder/jsx/react.questions.js +++ b/modules/instrument_builder/jsx/react.questions.js @@ -996,8 +996,9 @@ class AddElement extends Component { }); } - if(questionName.length > 64 && selected !== 'textbox' && selected !== 'textarea' && - selected !== 'date' && selected !== 'numeric') { + if (questionName.length > 64 && selected !== 'textbox' + && selected !== 'textarea' && selected !== 'date' + && selected !== 'numeric') { // Error, question name is needed for the desired type. Set the element // error flag for the questionName with message. Set the hasError flag let temp = (this.state.error) ? this.state.error : {}; @@ -1018,8 +1019,8 @@ class AddElement extends Component { // An error is present, return return; } - - if(questionText.length > 64) { + + if (questionText.length > 64) { // Error, question name is needed for the desired type. Set the element // error flag for the questionText with message. Set the hasError flag let temp = (this.state.error) ? this.state.error : {}; @@ -1041,8 +1042,9 @@ class AddElement extends Component { return; } - if(questionName.length > 57 && (selected === 'textbox' || selected === 'textarea' || - selected === 'date' || selected === 'numeric')) { + if (questionName.length > 57 && (selected === 'textbox' + || selected === 'textarea' || selected === 'date' + || selected === 'numeric')) { // Error, question name is needed for the desired type. Set the element // error flag for the questionName with message. Set the hasError flag let temp = (this.state.error) ? this.state.error : {}; From 376fd2ef50373ce9219c395b90ce08e5796f01be Mon Sep 17 00:00:00 2001 From: Satvik Singh <64309880+satvik-tha-god@users.noreply.github.com> Date: Tue, 14 Jun 2022 19:40:47 +0530 Subject: [PATCH 07/16] [instrument_builder][FIX] Minor fixes --- modules/instrument_builder/jsx/react.questions.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/instrument_builder/jsx/react.questions.js b/modules/instrument_builder/jsx/react.questions.js index 8137567bf76..62b3b2700ed 100644 --- a/modules/instrument_builder/jsx/react.questions.js +++ b/modules/instrument_builder/jsx/react.questions.js @@ -996,8 +996,8 @@ class AddElement extends Component { }); } - if (questionName.length > 64 && selected !== 'textbox' - && selected !== 'textarea' && selected !== 'date' + if (questionName.length > 64 && selected !== 'textbox' + && selected !== 'textarea' && selected !== 'date' && selected !== 'numeric') { // Error, question name is needed for the desired type. Set the element // error flag for the questionName with message. Set the hasError flag @@ -1042,8 +1042,8 @@ class AddElement extends Component { return; } - if (questionName.length > 57 && (selected === 'textbox' - || selected === 'textarea' || selected === 'date' + if (questionName.length > 57 && (selected === 'textbox' + || selected === 'textarea' || selected === 'date' || selected === 'numeric')) { // Error, question name is needed for the desired type. Set the element // error flag for the questionName with message. Set the hasError flag From 5ac5f24d32c7071fd2148d436fcc84269c9e0246 Mon Sep 17 00:00:00 2001 From: Satvik Singh <64309880+satvik-tha-god@users.noreply.github.com> Date: Thu, 21 Jul 2022 01:32:36 +0530 Subject: [PATCH 08/16] [instrument_builder] removed warnings for label question text --- modules/instrument_builder/jsx/react.questions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/instrument_builder/jsx/react.questions.js b/modules/instrument_builder/jsx/react.questions.js index 62b3b2700ed..e02c795b9bc 100644 --- a/modules/instrument_builder/jsx/react.questions.js +++ b/modules/instrument_builder/jsx/react.questions.js @@ -1020,7 +1020,7 @@ class AddElement extends Component { return; } - if (questionText.length > 64) { + if (questionText.length > 64 && selected !=='label') { // Error, question name is needed for the desired type. Set the element // error flag for the questionText with message. Set the hasError flag let temp = (this.state.error) ? this.state.error : {}; From 146e3d05a3f7d3dd22763800a890d144156e9b34 Mon Sep 17 00:00:00 2001 From: Satvik Singh <64309880+satvik-tha-god@users.noreply.github.com> Date: Thu, 21 Jul 2022 02:01:30 +0530 Subject: [PATCH 09/16] [instrument_builder] updated test plan for field warnings --- modules/instrument_builder/test/TestPlan.md | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/modules/instrument_builder/test/TestPlan.md b/modules/instrument_builder/test/TestPlan.md index 22ccab6ae97..d37697d84c9 100644 --- a/modules/instrument_builder/test/TestPlan.md +++ b/modules/instrument_builder/test/TestPlan.md @@ -4,21 +4,32 @@ Instrument builder Test Plan * 1.a Add Header * 1.b Add Label * 1.c Add Scored Field - * 1.c.1 Validate that this requires both QuestionName and QuestionText + * 1.c.1 Validate that this requires both QuestionName and QuestionText + * 1.c.2 Validate that both QuestionName and QuestionText require less than 65 characters * 1.d Add Textbox - * 1.d.1 Validate that this requires both QuestionName and QuestionText + * 1.d.1 Validate that this requires both QuestionName and QuestionText + * 1.d.2 Validate that QuestionName requires less than 58 characters + * 1.d.3 Validate that QuestionText requires less than 65 characters * 1.e Add Textarea - * 1.e.1 Validate that this requires both QuestionName and QuestionText + * 1.e.1 Validate that this requires both QuestionName and QuestionText + * 1.e.2 Validate that QuestionName requires less than 58 characters + * 1.e.3 Validate that QuestionText requires less than 65 characters * 1.f Add Dropdown - * 1.f.1 Validate that this requires both QuestionName and QuestionText + * 1.f.1 Validate that this requires both QuestionName and QuestionText + * 1.f.2 Validate that both QuestionName and QuestionText require less than 65 characters * 1.g Add Multiselect - * 1.g.1 Validate that this requires both QuestionName and QuestionText + * 1.g.1 Validate that this requires both QuestionName and QuestionText + * 1.g.2 Validate that both QuestionName and QuestionText require less than 65 characters * 1.h Add Date * 1.h.1 Validate that this requires both QuestionName and QuestionText * 1.h.2 Validate adding range (startyear-endyear) + * 1.h.3 Validate that QuestionName requires less than 58 characters + * 1.h.4 Validate that QuestionText requires less than 65 characters * 1.i Add Numeric * 1.i.1 Validate that this requires both QuestionName and QuestionText * 1.i.2 Validate adding range + * 1.i.3 Validate that QuestionName requires less than 58 characters + * 1.i.4 Validate that QuestionText requires less than 65 characters * 1.j Add Blank Line * 1.k Add Page break 2. Edit Question Name and Question Text in the table directly and check if it sticks. From 9a9e88aa6b3215343d72bf8405d316f5d47bbe9a Mon Sep 17 00:00:00 2001 From: satvik-tha-god Date: Fri, 29 Jul 2022 14:54:03 +0530 Subject: [PATCH 10/16] retrigger checks From e4479b32c78f2a7bc4a32c78c1cf0d48e09f5800 Mon Sep 17 00:00:00 2001 From: satvik-tha-god Date: Mon, 1 Aug 2022 12:55:52 +0530 Subject: [PATCH 11/16] retrigger checks From c67b84581902e4de493f0e0131d9863a13c5bd61 Mon Sep 17 00:00:00 2001 From: satvik-tha-god Date: Sun, 14 Aug 2022 03:32:38 +0530 Subject: [PATCH 12/16] retrigger checks From e3bcd3d348131fd391b1c4d90ff8bb6aab22d53f Mon Sep 17 00:00:00 2001 From: Satvik Singh <64309880+satvik-tha-god@users.noreply.github.com> Date: Wed, 7 Sep 2022 12:24:39 +0530 Subject: [PATCH 13/16] [instrument_builder] removed length checks for questionName --- .../instrument_builder/jsx/react.questions.js | 48 ------------------- 1 file changed, 48 deletions(-) diff --git a/modules/instrument_builder/jsx/react.questions.js b/modules/instrument_builder/jsx/react.questions.js index e02c795b9bc..bda7446cf7f 100644 --- a/modules/instrument_builder/jsx/react.questions.js +++ b/modules/instrument_builder/jsx/react.questions.js @@ -996,30 +996,6 @@ class AddElement extends Component { }); } - if (questionName.length > 64 && selected !== 'textbox' - && selected !== 'textarea' && selected !== 'date' - && selected !== 'numeric') { - // Error, question name is needed for the desired type. Set the element - // error flag for the questionName with message. Set the hasError flag - let temp = (this.state.error) ? this.state.error : {}; - temp.questionName = 'Please shorten to 64 characters maximum'; - this.setState({ - error: temp, - }); - hasError = true; - } else if (this.state.error) { - // No error, remove the element's questionName error flag if set - let temp = this.state.error; - delete temp.questionName; - this.setState({ - error: temp, - }); - } - if (hasError) { - // An error is present, return - return; - } - if (questionText.length > 64 && selected !=='label') { // Error, question name is needed for the desired type. Set the element // error flag for the questionText with message. Set the hasError flag @@ -1042,30 +1018,6 @@ class AddElement extends Component { return; } - if (questionName.length > 57 && (selected === 'textbox' - || selected === 'textarea' || selected === 'date' - || selected === 'numeric')) { - // Error, question name is needed for the desired type. Set the element - // error flag for the questionName with message. Set the hasError flag - let temp = (this.state.error) ? this.state.error : {}; - temp.questionName = 'Please shorten to 57 characters maximum'; - this.setState({ - error: temp, - }); - hasError = true; - } else if (this.state.error) { - // No error, remove the elememt's questionName error flag if set - let temp = this.state.error; - delete temp.questionName; - this.setState({ - error: temp, - }); - } - if (hasError) { - // An error is present, return - return; - } - if (questionName === '' && selected !== 'header' && selected !== 'label' && selected !== 'line' && selected !== 'page-break') { // Error, question name is needed for the desired type. Set the element From 2c14e80cc90ebfa7b6eb43ee4ec6f96ca96574f4 Mon Sep 17 00:00:00 2001 From: Satvik Singh <64309880+satvik-tha-god@users.noreply.github.com> Date: Wed, 19 Oct 2022 19:39:31 +0530 Subject: [PATCH 14/16] [instrument_builder] Update: restrict questionName and remove checks for questionText --- .../instrument_builder/jsx/react.questions.js | 38 ++++++++++++++++--- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/modules/instrument_builder/jsx/react.questions.js b/modules/instrument_builder/jsx/react.questions.js index bda7446cf7f..12be223ee76 100644 --- a/modules/instrument_builder/jsx/react.questions.js +++ b/modules/instrument_builder/jsx/react.questions.js @@ -995,20 +995,46 @@ class AddElement extends Component { error: temp, }); } - - if (questionText.length > 64 && selected !=='label') { + + if (questionName.length > 64 && selected !== 'textbox' + && selected !== 'textarea' && selected !== 'date' + && selected !== 'numeric') { // Error, question name is needed for the desired type. Set the element - // error flag for the questionText with message. Set the hasError flag + // error flag for the questionName with message. Set the hasError flag let temp = (this.state.error) ? this.state.error : {}; - temp.questionText = 'Please shorten to 64 characters maximum'; + temp.questionName = 'Please shorten to 64 characters maximum'; this.setState({ error: temp, }); hasError = true; } else if (this.state.error) { - // No error, remove the elememt's questionText error flag if set + // No error, remove the element's questionName error flag if set let temp = this.state.error; - delete temp.questionText; + delete temp.questionName; + this.setState({ + error: temp, + }); + } + if (hasError) { + // An error is present, return + return; + } + + if (questionName.length > 57 && (selected === 'textbox' + || selected === 'textarea' || selected === 'date' + || selected === 'numeric')) { + // Error, question name is needed for the desired type. Set the element + // error flag for the questionName with message. Set the hasError flag + let temp = (this.state.error) ? this.state.error : {}; + temp.questionName = 'Please shorten to 57 characters maximum'; + this.setState({ + error: temp, + }); + hasError = true; + } else if (this.state.error) { + // No error, remove the elememt's questionName error flag if set + let temp = this.state.error; + delete temp.questionName; this.setState({ error: temp, }); From 94c6f9a9f94980b4f091d3f354853dce1b9997ac Mon Sep 17 00:00:00 2001 From: Satvik Singh <64309880+satvik-tha-god@users.noreply.github.com> Date: Wed, 19 Oct 2022 19:49:11 +0530 Subject: [PATCH 15/16] [instrument_builder] fixed trailing spaces --- modules/instrument_builder/jsx/react.questions.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/instrument_builder/jsx/react.questions.js b/modules/instrument_builder/jsx/react.questions.js index 12be223ee76..b9431591e67 100644 --- a/modules/instrument_builder/jsx/react.questions.js +++ b/modules/instrument_builder/jsx/react.questions.js @@ -995,7 +995,7 @@ class AddElement extends Component { error: temp, }); } - + if (questionName.length > 64 && selected !== 'textbox' && selected !== 'textarea' && selected !== 'date' && selected !== 'numeric') { @@ -1019,7 +1019,7 @@ class AddElement extends Component { // An error is present, return return; } - + if (questionName.length > 57 && (selected === 'textbox' || selected === 'textarea' || selected === 'date' || selected === 'numeric')) { From 01f0ab9f3b7485c93c161c362c794adb06645cd2 Mon Sep 17 00:00:00 2001 From: Satvik Singh Date: Sat, 22 Oct 2022 21:47:24 +0530 Subject: [PATCH 16/16] Trigger Build