From 7b5fd672e7597b3eda6b1da8e87df8e73cd77157 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Tue, 25 Jul 2023 15:39:01 +0900 Subject: [PATCH] MOBILE-4272 workshop: Fix assessment --- src/addons/mod/forum/components/post/post.ts | 2 +- .../pages/new-discussion/new-discussion.ts | 2 +- .../accumulative/services/handler.ts | 4 +- .../assessment/numerrors/services/handler.ts | 4 +- .../index/addon-mod-workshop-index.html | 12 +- .../mod/workshop/services/workshop-helper.ts | 3 +- .../workshop/tests/behat/basic_usage.feature | 115 ++++++++++++++++++ 7 files changed, 129 insertions(+), 13 deletions(-) create mode 100644 src/addons/mod/workshop/tests/behat/basic_usage.feature diff --git a/src/addons/mod/forum/components/post/post.ts b/src/addons/mod/forum/components/post/post.ts index 8024b9c2512..63f44e1b17f 100644 --- a/src/addons/mod/forum/components/post/post.ts +++ b/src/addons/mod/forum/components/post/post.ts @@ -333,7 +333,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges * @param text The new text. */ onMessageChange(text?: string | null): void { - this.formData.message = text ?? ''; + this.formData.message = text ?? null; } /** diff --git a/src/addons/mod/forum/pages/new-discussion/new-discussion.ts b/src/addons/mod/forum/pages/new-discussion/new-discussion.ts index df9003480a6..3c49211735f 100644 --- a/src/addons/mod/forum/pages/new-discussion/new-discussion.ts +++ b/src/addons/mod/forum/pages/new-discussion/new-discussion.ts @@ -512,7 +512,7 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea * @param text The new text. */ onMessageChange(text?: string | null): void { - this.newDiscussion.message = text ?? ''; + this.newDiscussion.message = text ?? null; } /** diff --git a/src/addons/mod/workshop/assessment/accumulative/services/handler.ts b/src/addons/mod/workshop/assessment/accumulative/services/handler.ts index b6ca10e7cbd..563be19b885 100644 --- a/src/addons/mod/workshop/assessment/accumulative/services/handler.ts +++ b/src/addons/mod/workshop/assessment/accumulative/services/handler.ts @@ -129,9 +129,7 @@ export class AddonModWorkshopAssessmentStrategyAccumulativeHandlerService implem hasErrors = true; } - if (currentValues[idx].peercomment) { - data['peercomment__idx_' + idx] = currentValues[idx].peercomment; - } + data['peercomment__idx_' + idx] = currentValues[idx].peercomment ?? ''; data['gradeid__idx_' + idx] = parseInt(form.current[idx].gradeid, 10) || 0; data['dimensionid__idx_' + idx] = parseInt(field.dimensionid, 10); diff --git a/src/addons/mod/workshop/assessment/numerrors/services/handler.ts b/src/addons/mod/workshop/assessment/numerrors/services/handler.ts index b48e438c6cf..ce7e5dc3911 100644 --- a/src/addons/mod/workshop/assessment/numerrors/services/handler.ts +++ b/src/addons/mod/workshop/assessment/numerrors/services/handler.ts @@ -112,9 +112,7 @@ export class AddonModWorkshopAssessmentStrategyNumErrorsHandlerService implement hasErrors = true; } - if (currentValues[idx].peercomment) { - data['peercomment__idx_' + idx] = currentValues[idx].peercomment; - } + data['peercomment__idx_' + idx] = currentValues[idx].peercomment ?? ''; data['gradeid__idx_' + idx] = parseInt(form.current[idx].gradeid, 10) || 0; data['dimensionid__idx_' + idx] = parseInt(field.dimensionid, 10); diff --git a/src/addons/mod/workshop/components/index/addon-mod-workshop-index.html b/src/addons/mod/workshop/components/index/addon-mod-workshop-index.html index d5c71c7d2ae..a9ef7ca6450 100644 --- a/src/addons/mod/workshop/components/index/addon-mod-workshop-index.html +++ b/src/addons/mod/workshop/components/index/addon-mod-workshop-index.html @@ -23,12 +23,16 @@

{{ phases[workshop!.phase].title }}

phases[workshop!.phase].tasks.length"> - -