Skip to content

Commit f5b2199

Browse files
committed
Merge remote-tracking branch 'origin/main' into chore/semantic-interactive-elements
# Conflicts: # src/main/webapp/app/shared/components/atoms/rating/rating.component.html
2 parents 0644566 + 090140d commit f5b2199

32 files changed

Lines changed: 901 additions & 160 deletions

File tree

openapi/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3544,6 +3544,7 @@ components:
35443544
type: object
35453545
properties:
35463546
author: {type: string}
3547+
authorUserId: {type: string, format: uuid}
35473548
canEdit: {type: boolean}
35483549
commentId: {type: string, format: uuid}
35493550
createdAt: {type: string, format: date-time}
@@ -4071,6 +4072,7 @@ components:
40714072
type: object
40724073
properties:
40734074
from: {type: string}
4075+
fromUserId: {type: string, format: uuid}
40744076
rating: {type: integer, format: int32}
40754077
RatingOverviewDTO:
40764078
type: object

src/main/java/de/tum/cit/aet/evaluation/dto/InternalCommentDTO.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import java.util.UUID;
88
import lombok.NonNull;
99

10-
public record InternalCommentDTO(UUID commentId, String author, String message, Instant createdAt, boolean canEdit) {
10+
public record InternalCommentDTO(UUID commentId, UUID authorUserId, String author, String message, Instant createdAt, boolean canEdit) {
1111
/**
1212
* Creates a DTO representation of an internal comment for the given user context.
1313
*
@@ -22,6 +22,7 @@ public static InternalCommentDTO from(@NonNull InternalComment comment, @NonNull
2222
User author = comment.getCreatedBy();
2323
return new InternalCommentDTO(
2424
comment.getInternalCommentId(),
25+
author.getUserId(),
2526
author.getFirstName() + " " + author.getLastName(),
2627
comment.getMessage(),
2728
comment.getCreatedAt().toInstant(ZoneOffset.UTC),
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
package de.tum.cit.aet.evaluation.dto;
22

33
import de.tum.cit.aet.evaluation.domain.Rating;
4+
import de.tum.cit.aet.usermanagement.domain.User;
5+
import java.util.UUID;
46

5-
public record RatingDTO(String from, int rating) {
7+
public record RatingDTO(UUID fromUserId, String from, int rating) {
68
/**
79
* Creates a {@link RatingDTO} from a given {@link Rating} entity.
810
*
911
* @param rating the {@link Rating} entity to convert; must not be {@code null}
10-
* @return a {@link RatingDTO} containing the rater's full name and rating value
12+
* @return a {@link RatingDTO} containing the rater's id, full name and rating value
1113
*/
1214
public static RatingDTO from(Rating rating) {
13-
return new RatingDTO(rating.getFrom().getFirstName() + " " + rating.getFrom().getLastName(), rating.getRating());
15+
User rater = rating.getFrom();
16+
return new RatingDTO(rater.getUserId(), rater.getFirstName() + " " + rater.getLastName(), rating.getRating());
1417
}
1518
}

src/main/webapp/app/config/font-awesome-icons.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ import {
113113
faSortUp,
114114
faSpinner,
115115
faStar,
116+
faStarHalfStroke,
116117
faSun,
117118
faSync,
118119
faTableList,
@@ -255,6 +256,7 @@ export const fontAwesomeIcons = [
255256
faSortDown,
256257
faSortUp,
257258
faStar,
259+
faStarHalfStroke,
258260
faSun,
259261
faSync,
260262
faTableList,

src/main/webapp/app/evaluation/application-detail/application-detail.component.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,12 +385,16 @@ <h1>
385385
<div class="grid gap-16 grid-cols-1 md:grid-cols-[3fr_7fr]">
386386
<div>
387387
<jhi-section titleKey="evaluation.details.ratingTitle" icon="star">
388-
<jhi-rating-section [applicationId]="currentApplicationId()" (ratingUpdated)="onRatingUpdated()" />
388+
<jhi-rating-section
389+
[applicationId]="currentApplicationId()"
390+
(ratingUpdated)="onRatingUpdated()"
391+
(ratingsLoaded)="applicationRatings.set($event)"
392+
/>
389393
</jhi-section>
390394
</div>
391395
<div>
392396
<jhi-section titleKey="evaluation.details.commentTitle" icon="comments">
393-
<jhi-comment-section [applicationId]="currentApplicationId()" />
397+
<jhi-comment-section [applicationId]="currentApplicationId()" [ratings]="applicationRatings()" />
394398
</jhi-section>
395399
</div>
396400
</div>

src/main/webapp/app/evaluation/application-detail/application-detail.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { AcceptDTO } from 'app/generated/model/accept-dto';
2323
import { RejectDTO } from 'app/generated/model/reject-dto';
2424
import { ApplicationEvaluationDetailListDTO } from 'app/generated/model/application-evaluation-detail-list-dto';
2525
import { ApplicationDocumentIdsDTO } from 'app/generated/model/application-document-ids-dto';
26+
import { RatingOverviewDTO } from 'app/generated/model/rating-overview-dto';
2627
import { formatGradeWithTranslation } from 'app/core/util/grade-conversion';
2728
import LocalizedDatePipe from 'app/shared/pipes/localized-date.pipe';
2829
import { TooltipModule } from 'primeng/tooltip';
@@ -168,6 +169,9 @@ export class ApplicationDetailComponent {
168169
return this.currentApplication()?.applicationDetailDTO.applicationId;
169170
});
170171

172+
/** Loaded once by the rating section and shared with the comment section, which shows each comment author's rating. */
173+
protected readonly applicationRatings = signal<RatingOverviewDTO | undefined>(undefined);
174+
171175
protected readonly CAROUSEL_SIZE = CAROUSEL_SIZE;
172176
protected readonly sortableFields = sortableFields;
173177

src/main/webapp/app/generated/model/internal-comment-dto.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
export interface InternalCommentDTO {
1313
readonly author?: string;
14+
readonly authorUserId?: string;
1415
readonly canEdit?: boolean;
1516
readonly commentId?: string;
1617
readonly createdAt?: string;

src/main/webapp/app/generated/model/rating-dto.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111

1212
export interface RatingDTO {
1313
readonly from?: string;
14+
readonly fromUserId?: string;
1415
readonly rating?: number;
1516
}

src/main/webapp/app/interview/interviewee-assessment/interviewee-assessment.component.html

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,7 @@ <h3 class="text-lg font-bold text-text-primary mb-0" jhiTranslate="interview.ass
3232

3333
<p class="text-text-secondary text-sm mb-2" jhiTranslate="interview.assessment.rating.info">Rate the interview.</p>
3434

35-
<div class="flex items-center gap-4 h-10">
36-
<jhi-rating [(rating)]="rating" [selectable]="true" class="flex-1" />
37-
</div>
38-
<span class="text-text-secondary text-sm" jhiTranslate="evaluation.details.ratingYourRatingLabel"
39-
>Click a box to select your rating</span
40-
>
35+
<jhi-rating [(rating)]="rating" [selectable]="true" />
4136
</div>
4237

4338
<!-- Notes Section -->
Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,44 @@
1-
<div class="flex gap-[2%] w-full max-w-[21rem] h-4 rounded-pill overflow-hidden">
2-
@for (item of likertValues; track $index) {
3-
<button
4-
type="button"
5-
class="btn-bare flex-1 transition-colors"
6-
[class]="selectable() ? 'cursor-pointer hover:brightness-75' : ''"
7-
[style.background-color]="getSectionColor($index)"
8-
[pTooltip]="tooltipTexts()[$index]"
9-
tooltipPosition="top"
10-
(click)="onSectionClick($index)"
11-
></button>
12-
}
13-
</div>
1+
@if (selectable()) {
2+
<div class="inline-flex flex-col gap-1">
3+
<div
4+
class="flex items-center gap-1"
5+
role="radiogroup"
6+
[attr.aria-label]="groupLabel()"
7+
(mouseleave)="onHoverLeave()"
8+
(focusout)="onHoverLeave()"
9+
>
10+
@for (star of stars(); track star.value) {
11+
<button
12+
#starButton
13+
type="button"
14+
role="radio"
15+
class="p-0.5 rounded-sm border-0 bg-transparent cursor-pointer outline-none focus-visible:ring-3 focus-visible:ring-primary"
16+
[attr.aria-checked]="star.selected"
17+
[attr.aria-label]="star.label"
18+
[attr.tabindex]="star.tabbable ? 0 : -1"
19+
(click)="onStarClick(star.value)"
20+
(keydown)="onKeydown($event)"
21+
(mouseenter)="onStarHover(star.value)"
22+
(focus)="onStarHover(star.value)"
23+
>
24+
<fa-icon
25+
class="text-lg transition-colors"
26+
[class]="star.filled ? star.colourClass : emptyStarColourClass"
27+
[icon]="['fas', 'star']"
28+
/>
29+
</button>
30+
}
31+
</div>
32+
<!-- Height is reserved so previewing or picking a rating does not shift the surrounding layout. -->
33+
<span class="min-h-5 text-sm text-text-secondary">{{ selectedLabel() }}</span>
34+
</div>
35+
} @else {
36+
<div class="inline-flex items-center gap-1" role="img" [attr.aria-label]="readonlyLabel()">
37+
@for (star of stars(); track star.value) {
38+
<fa-icon class="text-base" [class]="star.filled ? star.colourClass : emptyStarColourClass" [icon]="['fas', 'star']" />
39+
}
40+
@if (selectedLabel() !== '') {
41+
<span class="ml-1.5 text-sm text-text-secondary">{{ selectedLabel() }}</span>
42+
}
43+
</div>
44+
}

0 commit comments

Comments
 (0)