Skip to content

Commit

Permalink
#2406 move current value from 'Last visit' to 'Last study activity' f…
Browse files Browse the repository at this point in the history
…ield
  • Loading branch information
naXa777 committed Oct 24, 2023
1 parent a3a04f0 commit af8481f
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface User {
spentTime: number;
studyDaysInCurrentMonth: number;
userId: string;
lastVisit: string;
}

export interface UserMapped extends User {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,27 @@
</td>
</ng-container>

<ng-container matColumnDef="lastDone">
<ng-container matColumnDef="lastVisit">
<th mat-header-cell *matHeaderCellDef mat-sort-header>
{{
'Admin.Modules.Users.Components.UsersTable.ColumnsName.LastVisit'
| translate
}}
</th>
<td mat-cell *matCellDef="let user">
<div *ngIf="user.lastVisit" class="subItem">
{{ user.lastVisit | date: 'medium' }}
</div>
</td>
</ng-container>

<ng-container matColumnDef="lastDone">
<th mat-header-cell *matHeaderCellDef mat-sort-header>
{{
'Admin.Modules.Users.Components.UsersTable.ColumnsName.LastStudyActivity'
| translate
}}
</th>
<td mat-cell *matCellDef="let user">
<div *ngIf="user.lastDone" class="subItem">
{{ user.lastDone | date: 'medium' }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ describe('UsersComponent', () => {
active: true,
firstDone: '2021-12-13T19:07:04.832',
lastDone: '2021-12-15T19:07:04.832',
lastVisit: '2023-10-24T19:07:04.832',
lastWeek: [],
studyDaysInCurrentMonth: 1,
diagnosticProgress: {
Expand All @@ -70,6 +71,7 @@ describe('UsersComponent', () => {
active: true,
firstDone: '2021-12-17T19:07:04.832',
lastDone: '2021-12-20T19:07:04.832',
lastVisit: '2023-10-24T19:07:04.832',
lastWeek: [],
studyDaysInCurrentMonth: 2,
diagnosticProgress: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export class UsersComponent implements OnInit, OnDestroy {
'name',
'firstDone',
'lastDone',
'lastVisit',
'currentWeek',
'spentTime',
'doneExercises',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { getRandomString } from '@shared/helpers/get-random-string';

export class AdminApiServiceFake
implements Pick<AdminApiService,
'getUserWeeklyStatistics' | 'getUserYearlyStatistics' | 'getUserDailyDetailStatistics' | 'getUsers' | 'getUserDailyDetailStatistics'> {
'getUserWeeklyStatistics' | 'getUserYearlyStatistics' | 'getUsers' | 'getUserDailyDetailStatistics'> {
private readonly options: IOptions = {};

constructor(o?: IOptions) {
Expand Down Expand Up @@ -94,6 +94,7 @@ export class AdminApiServiceFake
Date.now() - getRandomIntInclusive(0, 365 * 24 * 60 * 60 * 1000),
).toISOString();
const lastDone = dayjs(firstDone).add(1, 'month').toISOString();
const lastVisit = dayjs(lastDone).add(1, 'day').toISOString();

const lastWeek: number[] = [];
for (let dayNumber = 0; dayNumber < DAYS_IN_WEEK; dayNumber++) {
Expand Down Expand Up @@ -126,6 +127,7 @@ export class AdminApiServiceFake
userId: '1234',
spentTime: 10,
doneExercises: 2,
lastVisit,
});
}

Expand Down
1 change: 1 addition & 0 deletions frontend-angular/src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"Favorite": "Favorite",
"FirstVisit": "First visit",
"LastVisit": "Last visit",
"LastStudyActivity": "Last study activity",
"CurrentWeek": "Current week",
"Name": "Name",
"Progress": "Progress",
Expand Down
1 change: 1 addition & 0 deletions frontend-angular/src/assets/i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"Favorite": "Любимый",
"FirstVisit": "Первый визит",
"LastVisit": "Последнее посещение",
"LastStudyActivity": "Последнее учебное занятие",
"CurrentWeek": "Текущая неделя",
"Name": "Имя",
"Progress": "Прогресс",
Expand Down
1 change: 0 additions & 1 deletion src/main/kotlin/com/epam/brn/dto/UserAccountDto.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ data class UserAccountDto(
var active: Boolean = true,
val created: LocalDateTime = LocalDateTime.now(ZoneOffset.UTC),
val changed: LocalDateTime = LocalDateTime.now(ZoneOffset.UTC),
val lastVisit: LocalDateTime? = null,
var avatar: String? = null,
val photo: String? = null,
val description: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@ data class UserWithAnalyticsResponse(
var diagnosticProgress: Map<AudiometryType, Boolean> = mapOf(AudiometryType.SIGNALS to true), // todo fill by user
var doneExercises: Int = 0, // for all time
var spentTime: Duration = Duration.ZERO, // spent time by doing exercises for all time
/**
* Last visit to our site
*/
val lastVisit: LocalDateTime? = null,
)
2 changes: 1 addition & 1 deletion src/main/kotlin/com/epam/brn/model/UserAccount.kt
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ data class UserAccount(
gender = gender?.let { BrnGender.valueOf(it) },
created = created,
changed = changed,
lastVisit = lastVisit ?: created,
avatar = avatar,
photo = photo,
description = description,
Expand All @@ -105,6 +104,7 @@ data class UserAccount(
email = email,
bornYear = bornYear,
gender = gender?.let { BrnGender.valueOf(it) },
lastVisit = lastVisit ?: created,
)

override fun equals(other: Any?): Boolean {
Expand Down

0 comments on commit af8481f

Please sign in to comment.