From b67c69c3908ba11de88d5a4ebd16fcda352e18ae Mon Sep 17 00:00:00 2001 From: Matti Lupari Date: Sun, 26 Nov 2023 23:42:12 +0200 Subject: [PATCH] CSCEXAM-1208 Question tag casing issue modifications --- app/controllers/QuestionController.java | 2 +- app/util/xml/MoodleXmlImporterImpl.scala | 2 +- .../app/question/library/results/library-results.component.ts | 2 +- ui/src/app/question/tags/tag-picker.component.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/QuestionController.java b/app/controllers/QuestionController.java index cbee79ae96..697bce2a4b 100644 --- a/app/controllers/QuestionController.java +++ b/app/controllers/QuestionController.java @@ -241,7 +241,7 @@ private Question parseFromBody(Http.Request request, User user, Question existin } if (tag.isEmpty()) { Tag newTag = new Tag(); - newTag.setName(tagNode.get("name").asText()); + newTag.setName(tagNode.get("name").asText().toLowerCase()); newTag.setCreatorWithDate(user); newTag.setModifier(user); tag = Optional.of(newTag); diff --git a/app/util/xml/MoodleXmlImporterImpl.scala b/app/util/xml/MoodleXmlImporterImpl.scala index efa4cf9364..c2fcc7b82d 100644 --- a/app/util/xml/MoodleXmlImporterImpl.scala +++ b/app/util/xml/MoodleXmlImporterImpl.scala @@ -38,7 +38,7 @@ class MoodleXmlImporterImpl @Inject()(fileHandler: FileHandler) extends MoodleXm case h :: _ => h case _ => val t = new Tag - t.setName(text) + t.setName(text.toLowerCase) t.setCreator(user) t } diff --git a/ui/src/app/question/library/results/library-results.component.ts b/ui/src/app/question/library/results/library-results.component.ts index 8051bb374e..100b04c372 100644 --- a/ui/src/app/question/library/results/library-results.component.ts +++ b/ui/src/app/question/library/results/library-results.component.ts @@ -141,7 +141,7 @@ export class LibraryResultsComponent implements OnInit, OnChanges { return user; }; - printTags = (question: LibraryQuestion) => question.tags.map((t) => t.name.toUpperCase()).join(', '); + printTags = (question: LibraryQuestion) => question.tags.map((t) => t.name).join(', '); pageSelected = (event: { page: number }) => (this.currentPage = event.page); diff --git a/ui/src/app/question/tags/tag-picker.component.ts b/ui/src/app/question/tags/tag-picker.component.ts index 2f19679dee..615dcd7bf6 100644 --- a/ui/src/app/question/tags/tag-picker.component.ts +++ b/ui/src/app/question/tags/tag-picker.component.ts @@ -44,7 +44,7 @@ import { QuestionDraft } from '../question.service'; maxlength="30" class="form-control col-md-8" [(ngModel)]="tagName" - lowerCase + xmLowerCase [ngbTypeahead]="getTags$" (selectItem)="onTagSelect($event)" [resultFormatter]="nameFormat"