Skip to content

Commit

Permalink
Merge branch 'dev' into CSCEXAM-1256
Browse files Browse the repository at this point in the history
  • Loading branch information
lupari authored Dec 11, 2023
2 parents 37773a7 + 2935d3a commit 8f266cb
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/scala.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v2
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 21
distribution: temurin

- name: Set up Node 18
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 18.x
Expand All @@ -47,7 +47,7 @@ jobs:
npm run build
cd ..
- name: Run tests
- name: Build backend and run tests
run: |
sed -i 's/\/var\/log\/exam/logs/g' $GITHUB_WORKSPACE/conf/logback.xml
sbt test
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/QuestionController.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public Result getQuestion(Long id, Http.Request request) {
Query<Question> query = DB.find(Question.class);
PathProperties pp = PathProperties.parse(
"(*, questionOwners(id, firstName, lastName, userIdentifier, email), " +
"attachment(id, fileName), options(id, correctOption, defaultScore, option, claimChoiceType), tags(id, name), " +
"attachment(id, fileName), options(id, correctOption, defaultScore, option, claimChoiceType), tags(id, name, creator(id)), " +
"examSectionQuestions(id, examSection(name, exam(name, state))))"
);
pp.apply(query);
Expand Down
1 change: 1 addition & 0 deletions ui/src/app/exam/exam.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export interface ReverseQuestion extends Question {
export interface Tag {
id?: number;
name: string;
creator?: User;
questions: Question[];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ export class LibraryResultsComponent implements OnInit, OnChanges {
return user;
};

printTags = (question: LibraryQuestion) => question.tags.map((t) => t.name).join(', ');
printTags = (question: LibraryQuestion) => {
const ownTags = question.tags.filter((t) => t.creator?.id === this.user.id);
return ownTags.map((t) => t.name).join(', ');
};

pageSelected = (event: { page: number }) => (this.currentPage = event.page);

Expand Down
15 changes: 11 additions & 4 deletions ui/src/app/question/tags/tag-picker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
* See the Licence for the specific language governing permissions and limitations under the Licence.
*/
import { HttpClient } from '@angular/common/http';
import { Component, Input } from '@angular/core';
import { Component, Input, OnInit } from '@angular/core';
import type { NgbTypeaheadSelectItemEvent } from '@ng-bootstrap/ng-bootstrap';
import type { Observable } from 'rxjs';
import { from } from 'rxjs';
import { debounceTime, distinctUntilChanged, exhaustMap, map } from 'rxjs/operators';
import { SessionService } from 'src/app/session/session.service';
import type { Question, Tag } from '../../exam/exam.model';
import { QuestionDraft } from '../question.service';

Expand Down Expand Up @@ -61,7 +62,7 @@ import { QuestionDraft } from '../question.service';
</div>
<div class="col">
<ul class="list-inline mart10">
<li *ngFor="let tag of question.tags" class="list-inline-item">
<li *ngFor="let tag of ownTags" class="list-inline-item">
{{ tag.name }}
<button
class="reviewer-remove"
Expand All @@ -80,12 +81,18 @@ import { QuestionDraft } from '../question.service';
</form>
`,
})
export class TagPickerComponent {
export class TagPickerComponent implements OnInit {
@Input() question!: Question | QuestionDraft;
tagName = '';
newTag: Tag = { name: '', questions: [] };
ownTags: Tag[] = [];

constructor(private http: HttpClient) {}

constructor(private http: HttpClient, private Session: SessionService) {}

ngOnInit() {
this.ownTags = this.question.tags.filter((t) => t.creator?.id === this.Session.getUser().id);
}

getTags$ = (text$: Observable<string>): Observable<Tag[]> =>
text$.pipe(
Expand Down

0 comments on commit 8f266cb

Please sign in to comment.