diff --git a/README.md b/README.md index 9702eb0ff..f9889021b 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ end-point specification is here: https://github.com/Brain-up/brn/blob/master/api Note that if you are using IntelliJ, you may want to use version 2019.2 and later to avoid issues with new kotlin plugin. #### Useful Postman scripts: -- [Script](./postman_scripts/generate_month_history.js) to generate month tasks statistic (you can use it with `brnlogin` request in `Test` tab) +- [Script](./postman_scripts/generate_month_history.js) to generate month tasks statistics (you can use it with `brnlogin` request in `Test` tab) ### Deploy Application USING DOCKER COMPOSE: (back-end part and front-end parts, but it is rather slow. it is better to use GitPod) diff --git a/api-contract/api.raml b/api-contract/api.raml index b2d8c5440..7e34c6ec2 100644 --- a/api-contract/api.raml +++ b/api-contract/api.raml @@ -670,10 +670,10 @@ annotationTypes: description: Second version of API # STATISTICS ---------------------------------- /statistics: - description: Contains actions over user statistic details + description: Contains actions over user statistics details /study/day: get: - description: Get user's details daily statistic for the day. Where day is a date in the ISO date time format + description: Get user's details daily statistics for the day. Where day is a date in the ISO date time format queryParameters: userId: type: integer @@ -707,7 +707,7 @@ annotationTypes: } /study/week: get: - description: Get user's weekly statistic for period. Where period is a two dates in the ISO date time format + description: Get user's weekly statistics for period. Where period is a two dates in the ISO date time format queryParameters: from: required: true @@ -737,7 +737,7 @@ annotationTypes: } /study/year: get: - description: Get user's yearly statistic for period. Where period is a two dates in the ISO date time format + description: Get user's yearly statistics for period. Where period is a two dates in the ISO date time format queryParameters: from: required: true diff --git a/roadmap.md b/roadmap.md index 53277a885..00e1cc6e0 100644 --- a/roadmap.md +++ b/roadmap.md @@ -26,7 +26,7 @@ Start to implement mobile version of application. 2022 Implement `Diagnostic` module with 3 tests for user to measure their progress in application regularly. -Implement `Statistic` module for analysing how regular user make exercises. +Implement `Statistics` module for analysing how regular user make exercises. Implement new design for site. Platform updates and requirements gathering. diff --git a/src/main/kotlin/com/epam/brn/controller/UserStatisticControllerV2.kt b/src/main/kotlin/com/epam/brn/controller/UserStatisticControllerV2.kt index a5567fdf4..355945ac0 100644 --- a/src/main/kotlin/com/epam/brn/controller/UserStatisticControllerV2.kt +++ b/src/main/kotlin/com/epam/brn/controller/UserStatisticControllerV2.kt @@ -2,12 +2,12 @@ package com.epam.brn.controller import com.epam.brn.service.RoleService import com.epam.brn.dto.response.BrnResponse -import com.epam.brn.dto.statistic.DayStudyStatistic -import com.epam.brn.dto.statistic.MonthStudyStatistic -import com.epam.brn.dto.statistic.UserDailyDetailStatisticsDto +import com.epam.brn.dto.statistics.DayStudyStatistics +import com.epam.brn.dto.statistics.MonthStudyStatistics +import com.epam.brn.dto.statistics.UserDailyDetailStatisticsDto import com.epam.brn.enums.BrnRole import com.epam.brn.service.StudyHistoryService -import com.epam.brn.service.statistic.UserPeriodStatisticService +import com.epam.brn.service.statistics.UserPeriodStatisticsService import io.swagger.v3.oas.annotations.Operation import io.swagger.v3.oas.annotations.tags.Tag import org.springframework.http.ResponseEntity @@ -20,46 +20,46 @@ import javax.annotation.security.RolesAllowed @RestController @RequestMapping("/v2/statistics") -@Tag(name = "Statistics", description = "Contains actions over user statistic details") +@Tag(name = "Statistics", description = "Contains actions over user statistics details") @RolesAllowed(BrnRole.USER) class UserStatisticControllerV2( - private val userDayStatisticService: UserPeriodStatisticService, - private val userMonthStatisticService: UserPeriodStatisticService, + private val userDayStatisticService: UserPeriodStatisticsService, + private val userMonthStatisticService: UserPeriodStatisticsService, private val historyService: StudyHistoryService, private val roleService: RoleService ) { @GetMapping("/study/year") - @Operation(summary = "Get user's yearly statistic for the period. Where period is a two dates in the ISO date time format") - fun getUserYearlyStatistic( + @Operation(summary = "Get user's yearly statistics for the period. Where period is a two dates in the ISO date time format") + fun getUserYearlyStatistics( @RequestParam(name = "from", required = true) from: LocalDateTime, @RequestParam(name = "to", required = true) to: LocalDateTime, @RequestParam(name = "userId") userId: Long? - ): ResponseEntity>> { + ): ResponseEntity>> { val result = if (userId != null && roleService.isCurrentUserAdmin()) { - userMonthStatisticService.getStatisticForPeriod(from, to, userId) + userMonthStatisticService.getStatisticsForPeriod(from, to, userId) } else { - userMonthStatisticService.getStatisticForPeriod(from, to) + userMonthStatisticService.getStatisticsForPeriod(from, to) } return ResponseEntity.ok().body(BrnResponse(data = result)) } @GetMapping("/study/week") - @Operation(summary = "Get user's weekly statistic for the period. Where period is a two dates in the ISO date time format") - fun getUserWeeklyStatistic( + @Operation(summary = "Get user's weekly statistics for the period. Where period is a two dates in the ISO date time format") + fun getUserWeeklyStatistics( @RequestParam(name = "from", required = true) from: LocalDateTime, @RequestParam(name = "to", required = true) to: LocalDateTime, @RequestParam(name = "userId") userId: Long? - ): ResponseEntity>> { + ): ResponseEntity>> { val result = if (userId != null && roleService.isCurrentUserAdmin()) { - userDayStatisticService.getStatisticForPeriod(from, to, userId) + userDayStatisticService.getStatisticsForPeriod(from, to, userId) } else { - userDayStatisticService.getStatisticForPeriod(from, to) + userDayStatisticService.getStatisticsForPeriod(from, to) } return ResponseEntity.ok().body(BrnResponse(data = result)) } @GetMapping("/study/day") - @Operation(summary = "Get user's details daily statistic for the day. Where day is a date in the ISO date time format") + @Operation(summary = "Get user's details daily statistics for the day. Where day is a date in the ISO date time format") fun getUserDailyDetailsStatistics( @RequestParam(name = "day", required = true) day: LocalDateTime, @RequestParam(name = "userId") userId: Long? diff --git a/src/main/kotlin/com/epam/brn/controller/UserSubGroupStatisticController.kt b/src/main/kotlin/com/epam/brn/controller/UserSubGroupStatisticController.kt index 9d2bf4cc0..86dafbfe4 100644 --- a/src/main/kotlin/com/epam/brn/controller/UserSubGroupStatisticController.kt +++ b/src/main/kotlin/com/epam/brn/controller/UserSubGroupStatisticController.kt @@ -1,9 +1,9 @@ package com.epam.brn.controller import com.epam.brn.dto.response.BrnResponse -import com.epam.brn.dto.response.SubGroupStatisticResponse +import com.epam.brn.dto.response.SubGroupStatisticsResponse import com.epam.brn.enums.BrnRole -import com.epam.brn.service.statistic.UserStatisticService +import com.epam.brn.service.statistics.UserStatisticService import io.swagger.v3.oas.annotations.Operation import io.swagger.v3.oas.annotations.tags.Tag import org.springframework.http.ResponseEntity @@ -15,16 +15,16 @@ import javax.annotation.security.RolesAllowed @RestController @RequestMapping("/statistics") -@Tag(name = "Statistics", description = "Contains actions over user statistic details") +@Tag(name = "Statistics", description = "Contains actions over user statistics details") @RolesAllowed(BrnRole.USER) class UserSubGroupStatisticController( - private val userStatisticService: UserStatisticService, + private val userStatisticService: UserStatisticService, ) { @GetMapping("/subgroups") @Operation(summary = "Get user's subgroup statistics") fun getUserSubGroupStatistic( @RequestParam(value = "ids", required = true) ids: List - ): ResponseEntity>> { + ): ResponseEntity>> { val userStatistic = userStatisticService.getSubGroupStatistic(ids) return ResponseEntity.ok().body(BrnResponse(data = userStatistic)) } diff --git a/src/main/kotlin/com/epam/brn/dto/response/SubGroupStatisticResponse.kt b/src/main/kotlin/com/epam/brn/dto/response/SubGroupStatisticsResponse.kt similarity index 57% rename from src/main/kotlin/com/epam/brn/dto/response/SubGroupStatisticResponse.kt rename to src/main/kotlin/com/epam/brn/dto/response/SubGroupStatisticsResponse.kt index df6e9d245..503d7d446 100644 --- a/src/main/kotlin/com/epam/brn/dto/response/SubGroupStatisticResponse.kt +++ b/src/main/kotlin/com/epam/brn/dto/response/SubGroupStatisticsResponse.kt @@ -1,12 +1,12 @@ package com.epam.brn.dto.response -import com.epam.brn.dto.statistic.Statistic +import com.epam.brn.dto.statistics.Statistics /** *@author Nikolai Lazarev */ -data class SubGroupStatisticResponse( +data class SubGroupStatisticsResponse( val subGroupId: Long, val completedExercises: Int = 0, val totalExercises: Int -) : Statistic(progress = null) +) : Statistics(progress = null) diff --git a/src/main/kotlin/com/epam/brn/dto/response/UserWithAnalyticsResponse.kt b/src/main/kotlin/com/epam/brn/dto/response/UserWithAnalyticsResponse.kt index 85246b113..6a0824bd0 100644 --- a/src/main/kotlin/com/epam/brn/dto/response/UserWithAnalyticsResponse.kt +++ b/src/main/kotlin/com/epam/brn/dto/response/UserWithAnalyticsResponse.kt @@ -1,6 +1,6 @@ package com.epam.brn.dto.response -import com.epam.brn.dto.statistic.DayStudyStatistic +import com.epam.brn.dto.statistics.DayStudyStatistics import com.epam.brn.enums.AudiometryType import com.epam.brn.enums.BrnGender import com.fasterxml.jackson.annotation.JsonInclude @@ -18,7 +18,7 @@ data class UserWithAnalyticsResponse( var active: Boolean = true, var firstDone: LocalDateTime? = null, // generally first done exercise var lastDone: LocalDateTime? = null, // generally last done exercise - var lastWeek: List = emptyList(), + var lastWeek: List = emptyList(), var studyDaysInCurrentMonth: Int = 0, // amount of days in current month when user made any exercises var diagnosticProgress: Map = mapOf(AudiometryType.SIGNALS to true), // todo fill by user var doneExercises: Int = 0, // for all time diff --git a/src/main/kotlin/com/epam/brn/dto/statistic/DayStudyStatisticDto.kt b/src/main/kotlin/com/epam/brn/dto/statistics/DayStudyStatisticDto.kt similarity index 89% rename from src/main/kotlin/com/epam/brn/dto/statistic/DayStudyStatisticDto.kt rename to src/main/kotlin/com/epam/brn/dto/statistics/DayStudyStatisticDto.kt index 97e4afbe2..9ed0db7dd 100644 --- a/src/main/kotlin/com/epam/brn/dto/statistic/DayStudyStatisticDto.kt +++ b/src/main/kotlin/com/epam/brn/dto/statistics/DayStudyStatisticDto.kt @@ -1,4 +1,4 @@ -package com.epam.brn.dto.statistic +package com.epam.brn.dto.statistics /** * This class created to support legacy date format in responses and diff --git a/src/main/kotlin/com/epam/brn/dto/statistic/DayStudyStatistic.kt b/src/main/kotlin/com/epam/brn/dto/statistics/DayStudyStatistics.kt similarity index 82% rename from src/main/kotlin/com/epam/brn/dto/statistic/DayStudyStatistic.kt rename to src/main/kotlin/com/epam/brn/dto/statistics/DayStudyStatistics.kt index 469a99a54..a9f52aa59 100644 --- a/src/main/kotlin/com/epam/brn/dto/statistic/DayStudyStatistic.kt +++ b/src/main/kotlin/com/epam/brn/dto/statistics/DayStudyStatistics.kt @@ -1,13 +1,13 @@ -package com.epam.brn.dto.statistic +package com.epam.brn.dto.statistics import java.time.LocalDateTime import java.time.format.DateTimeFormatter -data class DayStudyStatistic( +data class DayStudyStatistics( val date: LocalDateTime, val exercisingTimeSeconds: Int, var progress: UserExercisingProgressStatus? = null -) : Statistic(progress) { +) : Statistics(progress) { fun toDto(): DayStudyStatisticDto = DayStudyStatisticDto( date = date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")), diff --git a/src/main/kotlin/com/epam/brn/dto/statistic/MonthStudyStatisticDto.kt b/src/main/kotlin/com/epam/brn/dto/statistics/MonthStudyStatisticDto.kt similarity index 90% rename from src/main/kotlin/com/epam/brn/dto/statistic/MonthStudyStatisticDto.kt rename to src/main/kotlin/com/epam/brn/dto/statistics/MonthStudyStatisticDto.kt index bf1e1e85a..60de98b81 100644 --- a/src/main/kotlin/com/epam/brn/dto/statistic/MonthStudyStatisticDto.kt +++ b/src/main/kotlin/com/epam/brn/dto/statistics/MonthStudyStatisticDto.kt @@ -1,4 +1,4 @@ -package com.epam.brn.dto.statistic +package com.epam.brn.dto.statistics /** * This class created to support legacy date format in responses and diff --git a/src/main/kotlin/com/epam/brn/dto/statistic/MonthStudyStatistic.kt b/src/main/kotlin/com/epam/brn/dto/statistics/MonthStudyStatistics.kt similarity index 84% rename from src/main/kotlin/com/epam/brn/dto/statistic/MonthStudyStatistic.kt rename to src/main/kotlin/com/epam/brn/dto/statistics/MonthStudyStatistics.kt index 47c0c2b8c..076a2831f 100644 --- a/src/main/kotlin/com/epam/brn/dto/statistic/MonthStudyStatistic.kt +++ b/src/main/kotlin/com/epam/brn/dto/statistics/MonthStudyStatistics.kt @@ -1,14 +1,14 @@ -package com.epam.brn.dto.statistic +package com.epam.brn.dto.statistics import java.time.LocalDateTime import java.time.format.DateTimeFormatter -data class MonthStudyStatistic( +data class MonthStudyStatistics( val date: LocalDateTime, val exercisingTimeSeconds: Int, val exercisingDays: Int, var progress: UserExercisingProgressStatus? -) : Statistic(progress) { +) : Statistics(progress) { fun toDto(): MonthStudyStatisticDto = MonthStudyStatisticDto( date = date.format(DateTimeFormatter.ofPattern("yyyy-MM")), diff --git a/src/main/kotlin/com/epam/brn/dto/statistic/Statistic.kt b/src/main/kotlin/com/epam/brn/dto/statistics/Statistics.kt similarity index 56% rename from src/main/kotlin/com/epam/brn/dto/statistic/Statistic.kt rename to src/main/kotlin/com/epam/brn/dto/statistics/Statistics.kt index acc965d6f..7fc133d74 100644 --- a/src/main/kotlin/com/epam/brn/dto/statistic/Statistic.kt +++ b/src/main/kotlin/com/epam/brn/dto/statistics/Statistics.kt @@ -1,8 +1,8 @@ -package com.epam.brn.dto.statistic +package com.epam.brn.dto.statistics /** *@author Nikolai Lazarev */ -abstract class Statistic( +abstract class Statistics( progress: UserExercisingProgressStatus? ) diff --git a/src/main/kotlin/com/epam/brn/dto/statistic/StatusRequirements.kt b/src/main/kotlin/com/epam/brn/dto/statistics/StatusRequirements.kt similarity index 83% rename from src/main/kotlin/com/epam/brn/dto/statistic/StatusRequirements.kt rename to src/main/kotlin/com/epam/brn/dto/statistics/StatusRequirements.kt index 1a8f0ec0b..f425ecb1f 100644 --- a/src/main/kotlin/com/epam/brn/dto/statistic/StatusRequirements.kt +++ b/src/main/kotlin/com/epam/brn/dto/statistics/StatusRequirements.kt @@ -1,4 +1,4 @@ -package com.epam.brn.dto.statistic +package com.epam.brn.dto.statistics /** *@author Nikolai Lazarev diff --git a/src/main/kotlin/com/epam/brn/dto/statistic/UserDailyDetailStatisticsDto.kt b/src/main/kotlin/com/epam/brn/dto/statistics/UserDailyDetailStatisticsDto.kt similarity index 94% rename from src/main/kotlin/com/epam/brn/dto/statistic/UserDailyDetailStatisticsDto.kt rename to src/main/kotlin/com/epam/brn/dto/statistics/UserDailyDetailStatisticsDto.kt index 790aa98f8..48f1d6647 100644 --- a/src/main/kotlin/com/epam/brn/dto/statistic/UserDailyDetailStatisticsDto.kt +++ b/src/main/kotlin/com/epam/brn/dto/statistics/UserDailyDetailStatisticsDto.kt @@ -1,4 +1,4 @@ -package com.epam.brn.dto.statistic +package com.epam.brn.dto.statistics import kotlin.time.Duration diff --git a/src/main/kotlin/com/epam/brn/dto/statistic/UserExercisingPeriod.kt b/src/main/kotlin/com/epam/brn/dto/statistics/UserExercisingPeriod.kt similarity index 70% rename from src/main/kotlin/com/epam/brn/dto/statistic/UserExercisingPeriod.kt rename to src/main/kotlin/com/epam/brn/dto/statistics/UserExercisingPeriod.kt index 4961bfc33..5e78af934 100644 --- a/src/main/kotlin/com/epam/brn/dto/statistic/UserExercisingPeriod.kt +++ b/src/main/kotlin/com/epam/brn/dto/statistics/UserExercisingPeriod.kt @@ -1,4 +1,4 @@ -package com.epam.brn.dto.statistic +package com.epam.brn.dto.statistics /** *@author Nikolai Lazarev diff --git a/src/main/kotlin/com/epam/brn/dto/statistic/UserExercisingProgressStatus.kt b/src/main/kotlin/com/epam/brn/dto/statistics/UserExercisingProgressStatus.kt similarity index 73% rename from src/main/kotlin/com/epam/brn/dto/statistic/UserExercisingProgressStatus.kt rename to src/main/kotlin/com/epam/brn/dto/statistics/UserExercisingProgressStatus.kt index ecd76479b..03b08fa26 100644 --- a/src/main/kotlin/com/epam/brn/dto/statistic/UserExercisingProgressStatus.kt +++ b/src/main/kotlin/com/epam/brn/dto/statistics/UserExercisingProgressStatus.kt @@ -1,4 +1,4 @@ -package com.epam.brn.dto.statistic +package com.epam.brn.dto.statistics /** *@author Nikolai Lazarev diff --git a/src/main/kotlin/com/epam/brn/repo/StudyHistoryRepository.kt b/src/main/kotlin/com/epam/brn/repo/StudyHistoryRepository.kt index e59bdecfd..223a45948 100644 --- a/src/main/kotlin/com/epam/brn/repo/StudyHistoryRepository.kt +++ b/src/main/kotlin/com/epam/brn/repo/StudyHistoryRepository.kt @@ -97,7 +97,7 @@ interface StudyHistoryRepository : CrudRepository { " COALESCE(SUM(s.spentTimeInSeconds), 0) AS spentTime, COUNT (DISTINCT s.exercise.id) as doneExercises" + " FROM StudyHistory s WHERE user_id = :userId" ) - fun getStatisticByUserAccountId(userId: Long?): UserStatisticView + fun getStatisticsByUserAccountId(userId: Long?): UserStatisticView @Query( "SELECT s FROM StudyHistory s " + diff --git a/src/main/kotlin/com/epam/brn/service/StudyHistoryService.kt b/src/main/kotlin/com/epam/brn/service/StudyHistoryService.kt index cb3303bb8..4ab18293a 100644 --- a/src/main/kotlin/com/epam/brn/service/StudyHistoryService.kt +++ b/src/main/kotlin/com/epam/brn/service/StudyHistoryService.kt @@ -1,7 +1,7 @@ package com.epam.brn.service import com.epam.brn.dto.StudyHistoryDto -import com.epam.brn.dto.statistic.UserDailyDetailStatisticsDto +import com.epam.brn.dto.statistics.UserDailyDetailStatisticsDto import com.epam.brn.exception.EntityNotFoundException import com.epam.brn.model.StudyHistory import com.epam.brn.repo.ExerciseRepository diff --git a/src/main/kotlin/com/epam/brn/service/impl/UserAnalyticsServiceImpl.kt b/src/main/kotlin/com/epam/brn/service/impl/UserAnalyticsServiceImpl.kt index 3588fcaef..7895a2b56 100644 --- a/src/main/kotlin/com/epam/brn/service/impl/UserAnalyticsServiceImpl.kt +++ b/src/main/kotlin/com/epam/brn/service/impl/UserAnalyticsServiceImpl.kt @@ -2,7 +2,7 @@ package com.epam.brn.service.impl import com.epam.brn.dto.AudioFileMetaData import com.epam.brn.dto.response.UserWithAnalyticsResponse -import com.epam.brn.dto.statistic.DayStudyStatistic +import com.epam.brn.dto.statistics.DayStudyStatistics import com.epam.brn.enums.ExerciseType import com.epam.brn.model.StudyHistory import com.epam.brn.repo.ExerciseRepository @@ -13,7 +13,7 @@ import com.epam.brn.service.TextToSpeechService import com.epam.brn.service.TimeService import com.epam.brn.service.UserAccountService import com.epam.brn.service.UserAnalyticsService -import com.epam.brn.service.statistic.UserPeriodStatisticService +import com.epam.brn.service.statistics.UserPeriodStatisticsService import org.springframework.data.domain.Pageable import org.springframework.stereotype.Service import java.io.InputStream @@ -28,7 +28,7 @@ class UserAnalyticsServiceImpl( private val userAccountRepository: UserAccountRepository, private val studyHistoryRepository: StudyHistoryRepository, private val exerciseRepository: ExerciseRepository, - private val userDayStatisticService: UserPeriodStatisticService, + private val userDayStatisticService: UserPeriodStatisticsService, private val timeService: TimeService, private val textToSpeechService: TextToSpeechService, private val userAccountService: UserAccountService, @@ -48,17 +48,17 @@ class UserAnalyticsServiceImpl( val startOfCurrentMonth = now.withDayOfMonth(1).with(LocalTime.MIN) users.onEach { user -> - user.lastWeek = userDayStatisticService.getStatisticForPeriod(from, to, user.id) + user.lastWeek = userDayStatisticService.getStatisticsForPeriod(from, to, user.id) user.studyDaysInCurrentMonth = countWorkDaysForMonth( - userDayStatisticService.getStatisticForPeriod(startOfCurrentMonth, now, user.id) + userDayStatisticService.getStatisticsForPeriod(startOfCurrentMonth, now, user.id) ) - val userStatistic = studyHistoryRepository.getStatisticByUserAccountId(user.id) + val userStatistics = studyHistoryRepository.getStatisticsByUserAccountId(user.id) user.apply { - this.firstDone = userStatistic.firstStudy - this.lastDone = userStatistic.lastStudy - this.spentTime = userStatistic.spentTime.toDuration(DurationUnit.SECONDS) - this.doneExercises = userStatistic.doneExercises + this.firstDone = userStatistics.firstStudy + this.lastDone = userStatistics.lastStudy + this.spentTime = userStatistics.spentTime.toDuration(DurationUnit.SECONDS) + this.doneExercises = userStatistics.doneExercises } } @@ -95,7 +95,7 @@ class UserAnalyticsServiceImpl( fun isMultiWords(seriesType: ExerciseType): Boolean = seriesType == ExerciseType.PHRASES || seriesType == ExerciseType.SENTENCE || seriesType == ExerciseType.WORDS_SEQUENCES - fun countWorkDaysForMonth(dayStudyStatistics: List): Int = + fun countWorkDaysForMonth(dayStudyStatistics: List): Int = dayStudyStatistics .map { it.date } .groupBy { it.dayOfMonth } diff --git a/src/main/kotlin/com/epam/brn/service/statistic/UserPeriodStatisticService.kt b/src/main/kotlin/com/epam/brn/service/statistic/UserPeriodStatisticService.kt deleted file mode 100644 index ffa50b201..000000000 --- a/src/main/kotlin/com/epam/brn/service/statistic/UserPeriodStatisticService.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.epam.brn.service.statistic - -import com.epam.brn.dto.statistic.Statistic -import java.time.LocalDateTime - -/** - *@author Nikolai Lazarev - */ -interface UserPeriodStatisticService { - - /** - * Should return statistic as Statistic implementation for period for from to to date - * @param from - beginning date of the period - * @param to - ending date of the period - * @param userId - id of the user for how get statistic - * @return list of implementations of Statistic - */ - fun getStatisticForPeriod(from: LocalDateTime, to: LocalDateTime, userId: Long? = null): List -} diff --git a/src/main/kotlin/com/epam/brn/service/statistics/UserPeriodStatisticsService.kt b/src/main/kotlin/com/epam/brn/service/statistics/UserPeriodStatisticsService.kt new file mode 100644 index 000000000..567a8cbfc --- /dev/null +++ b/src/main/kotlin/com/epam/brn/service/statistics/UserPeriodStatisticsService.kt @@ -0,0 +1,19 @@ +package com.epam.brn.service.statistics + +import com.epam.brn.dto.statistics.Statistics +import java.time.LocalDateTime + +/** + *@author Nikolai Lazarev + */ +interface UserPeriodStatisticsService { + + /** + * Should return statistics as Statistics implementation for period for from to to date + * @param from - beginning date of the period + * @param to - ending date of the period + * @param userId - id of the user for how get statistics + * @return list of implementations of Statistics + */ + fun getStatisticsForPeriod(from: LocalDateTime, to: LocalDateTime, userId: Long? = null): List +} diff --git a/src/main/kotlin/com/epam/brn/service/statistic/UserStatisticService.kt b/src/main/kotlin/com/epam/brn/service/statistics/UserStatisticService.kt similarity index 69% rename from src/main/kotlin/com/epam/brn/service/statistic/UserStatisticService.kt rename to src/main/kotlin/com/epam/brn/service/statistics/UserStatisticService.kt index d95a6a704..8fd122d4a 100644 --- a/src/main/kotlin/com/epam/brn/service/statistic/UserStatisticService.kt +++ b/src/main/kotlin/com/epam/brn/service/statistics/UserStatisticService.kt @@ -1,15 +1,15 @@ -package com.epam.brn.service.statistic +package com.epam.brn.service.statistics -import com.epam.brn.dto.statistic.Statistic +import com.epam.brn.dto.statistics.Statistics /** *@author Nikolai Lazarev */ -interface UserStatisticService { +interface UserStatisticService { /** * Should return subGroups progress for user - * @param subGroupsIds - list of sub groups ids which statistic should be returned + * @param subGroupsIds - list of sub groups ids which statistics should be returned * @return list of information how many exercises subGroup has and how many exercises user has completed in the * subGroup */ diff --git a/src/main/kotlin/com/epam/brn/service/statistic/impl/UserDayStatisticService.kt b/src/main/kotlin/com/epam/brn/service/statistics/impl/UserDayStatisticsService.kt similarity index 65% rename from src/main/kotlin/com/epam/brn/service/statistic/impl/UserDayStatisticService.kt rename to src/main/kotlin/com/epam/brn/service/statistics/impl/UserDayStatisticsService.kt index a59abe318..b72f5fa56 100644 --- a/src/main/kotlin/com/epam/brn/service/statistic/impl/UserDayStatisticService.kt +++ b/src/main/kotlin/com/epam/brn/service/statistics/impl/UserDayStatisticsService.kt @@ -1,22 +1,22 @@ -package com.epam.brn.service.statistic.impl +package com.epam.brn.service.statistics.impl -import com.epam.brn.dto.statistic.DayStudyStatistic -import com.epam.brn.dto.statistic.UserExercisingPeriod +import com.epam.brn.dto.statistics.DayStudyStatistics +import com.epam.brn.dto.statistics.UserExercisingPeriod import com.epam.brn.model.StudyHistory import com.epam.brn.repo.StudyHistoryRepository import com.epam.brn.service.UserAccountService -import com.epam.brn.service.statistic.UserPeriodStatisticService -import com.epam.brn.service.statistic.progress.status.ProgressStatusManager +import com.epam.brn.service.statistics.UserPeriodStatisticsService +import com.epam.brn.service.statistics.progress.status.ProgressStatusManager import org.springframework.stereotype.Service import java.time.LocalDateTime @Service -class UserDayStatisticService( +class UserDayStatisticsService( private val studyHistoryRepository: StudyHistoryRepository, private val userAccountService: UserAccountService, private val progressManager: ProgressStatusManager> -) : UserPeriodStatisticService { - override fun getStatisticForPeriod(from: LocalDateTime, to: LocalDateTime, userId: Long?): List { +) : UserPeriodStatisticsService { + override fun getStatisticsForPeriod(from: LocalDateTime, to: LocalDateTime, userId: Long?): List { val tempUserId = userId ?: userAccountService.getCurrentUserDto().id val studyHistories = studyHistoryRepository.getHistories( userId = tempUserId!!, @@ -27,8 +27,8 @@ class UserDayStatisticService( val filteredStudyHistories = studyHistories.filter { studyHistoryFilter -> studyHistoryFilter.startTime.toLocalDate() == it.startTime.toLocalDate() } - DayStudyStatistic( - exercisingTimeSeconds = filteredStudyHistories.sumBy { dayStudyHistory -> dayStudyHistory.executionSeconds }, + DayStudyStatistics( + exercisingTimeSeconds = filteredStudyHistories.sumOf { dayStudyHistory -> dayStudyHistory.executionSeconds }, date = it.startTime, progress = progressManager.getStatus(UserExercisingPeriod.DAY, filteredStudyHistories) ) diff --git a/src/main/kotlin/com/epam/brn/service/statistic/impl/UserMonthStatisticService.kt b/src/main/kotlin/com/epam/brn/service/statistics/impl/UserMonthStatisticsService.kt similarity index 71% rename from src/main/kotlin/com/epam/brn/service/statistic/impl/UserMonthStatisticService.kt rename to src/main/kotlin/com/epam/brn/service/statistics/impl/UserMonthStatisticsService.kt index e73b8389b..687f13122 100644 --- a/src/main/kotlin/com/epam/brn/service/statistic/impl/UserMonthStatisticService.kt +++ b/src/main/kotlin/com/epam/brn/service/statistics/impl/UserMonthStatisticsService.kt @@ -1,28 +1,28 @@ -package com.epam.brn.service.statistic.impl +package com.epam.brn.service.statistics.impl -import com.epam.brn.dto.statistic.MonthStudyStatistic -import com.epam.brn.dto.statistic.UserExercisingPeriod +import com.epam.brn.dto.statistics.MonthStudyStatistics +import com.epam.brn.dto.statistics.UserExercisingPeriod import com.epam.brn.model.StudyHistory import com.epam.brn.repo.StudyHistoryRepository import com.epam.brn.service.UserAccountService -import com.epam.brn.service.statistic.UserPeriodStatisticService -import com.epam.brn.service.statistic.progress.status.ProgressStatusManager +import com.epam.brn.service.statistics.UserPeriodStatisticsService +import com.epam.brn.service.statistics.progress.status.ProgressStatusManager import org.springframework.stereotype.Service import java.time.LocalDateTime import java.time.temporal.ChronoUnit @Service -class UserMonthStatisticService( +class UserMonthStatisticsService( private val studyHistoryRepository: StudyHistoryRepository, private val userAccountService: UserAccountService, private val progressManager: ProgressStatusManager> -) : UserPeriodStatisticService { +) : UserPeriodStatisticsService { - override fun getStatisticForPeriod( + override fun getStatisticsForPeriod( from: LocalDateTime, to: LocalDateTime, userId: Long? - ): List { + ): List { val tempUserId = userId ?: userAccountService.getCurrentUserDto().id val histories = studyHistoryRepository.getHistories( userId = tempUserId!!, @@ -33,9 +33,9 @@ class UserMonthStatisticService( val filteredHistories = histories.filter { historyFilter -> historyFilter.startTime.month == it.startTime.month } - MonthStudyStatistic( + MonthStudyStatistics( date = it.startTime, - exercisingTimeSeconds = filteredHistories.sumBy { studyHistory -> studyHistory.executionSeconds }, + exercisingTimeSeconds = filteredHistories.sumOf { studyHistory -> studyHistory.executionSeconds }, progress = progressManager.getStatus(UserExercisingPeriod.WEEK, filteredHistories), exercisingDays = filteredHistories.distinctBy { studyHistory -> studyHistory.startTime.truncatedTo(ChronoUnit.DAYS) }.size ) diff --git a/src/main/kotlin/com/epam/brn/service/statistic/impl/UserStatisticServiceImpl.kt b/src/main/kotlin/com/epam/brn/service/statistics/impl/UserStatisticServiceImpl.kt similarity index 74% rename from src/main/kotlin/com/epam/brn/service/statistic/impl/UserStatisticServiceImpl.kt rename to src/main/kotlin/com/epam/brn/service/statistics/impl/UserStatisticServiceImpl.kt index b7813ff70..1afae6bf7 100644 --- a/src/main/kotlin/com/epam/brn/service/statistic/impl/UserStatisticServiceImpl.kt +++ b/src/main/kotlin/com/epam/brn/service/statistics/impl/UserStatisticServiceImpl.kt @@ -1,10 +1,10 @@ -package com.epam.brn.service.statistic.impl +package com.epam.brn.service.statistics.impl -import com.epam.brn.dto.response.SubGroupStatisticResponse +import com.epam.brn.dto.response.SubGroupStatisticsResponse import com.epam.brn.repo.ExerciseRepository import com.epam.brn.repo.StudyHistoryRepository import com.epam.brn.service.UserAccountService -import com.epam.brn.service.statistic.UserStatisticService +import com.epam.brn.service.statistics.UserStatisticService import org.springframework.stereotype.Service /** @@ -16,12 +16,12 @@ class UserStatisticServiceImpl( private val studyHistoryRepository: StudyHistoryRepository, private val exerciseRepository: ExerciseRepository, private val userAccountService: UserAccountService, -) : UserStatisticService { +) : UserStatisticService { - override fun getSubGroupStatistic(subGroupsIds: List): List { + override fun getSubGroupStatistic(subGroupsIds: List): List { val userAccount = userAccountService.getCurrentUserDto() return subGroupsIds.map { - SubGroupStatisticResponse( + SubGroupStatisticsResponse( subGroupId = it, totalExercises = exerciseRepository.findExercisesBySubGroupId(it).size, completedExercises = studyHistoryRepository.getDoneExercises(it, userAccount.id!!).size diff --git a/src/main/kotlin/com/epam/brn/service/statistic/progress/status/ExercisingStatusRetriever.kt b/src/main/kotlin/com/epam/brn/service/statistics/progress/status/ExercisingStatusRetriever.kt similarity index 72% rename from src/main/kotlin/com/epam/brn/service/statistic/progress/status/ExercisingStatusRetriever.kt rename to src/main/kotlin/com/epam/brn/service/statistics/progress/status/ExercisingStatusRetriever.kt index c7bf7f9f0..632262199 100644 --- a/src/main/kotlin/com/epam/brn/service/statistic/progress/status/ExercisingStatusRetriever.kt +++ b/src/main/kotlin/com/epam/brn/service/statistics/progress/status/ExercisingStatusRetriever.kt @@ -1,7 +1,7 @@ -package com.epam.brn.service.statistic.progress.status +package com.epam.brn.service.statistics.progress.status -import com.epam.brn.dto.statistic.UserExercisingPeriod -import com.epam.brn.dto.statistic.UserExercisingProgressStatus +import com.epam.brn.dto.statistics.UserExercisingPeriod +import com.epam.brn.dto.statistics.UserExercisingProgressStatus /** *@author Nikolai Lazarev diff --git a/src/main/kotlin/com/epam/brn/service/statistic/progress/status/ProgressStatusManager.kt b/src/main/kotlin/com/epam/brn/service/statistics/progress/status/ProgressStatusManager.kt similarity index 62% rename from src/main/kotlin/com/epam/brn/service/statistic/progress/status/ProgressStatusManager.kt rename to src/main/kotlin/com/epam/brn/service/statistics/progress/status/ProgressStatusManager.kt index c826bd8e5..4c7092916 100644 --- a/src/main/kotlin/com/epam/brn/service/statistic/progress/status/ProgressStatusManager.kt +++ b/src/main/kotlin/com/epam/brn/service/statistics/progress/status/ProgressStatusManager.kt @@ -1,7 +1,7 @@ -package com.epam.brn.service.statistic.progress.status +package com.epam.brn.service.statistics.progress.status -import com.epam.brn.dto.statistic.UserExercisingPeriod -import com.epam.brn.dto.statistic.UserExercisingProgressStatus +import com.epam.brn.dto.statistics.UserExercisingPeriod +import com.epam.brn.dto.statistics.UserExercisingProgressStatus interface ProgressStatusManager { diff --git a/src/main/kotlin/com/epam/brn/service/statistic/progress/status/UserRestTimeRetriever.kt b/src/main/kotlin/com/epam/brn/service/statistics/progress/status/UserRestTimeRetriever.kt similarity index 92% rename from src/main/kotlin/com/epam/brn/service/statistic/progress/status/UserRestTimeRetriever.kt rename to src/main/kotlin/com/epam/brn/service/statistics/progress/status/UserRestTimeRetriever.kt index c3f9e7143..9222cdbb3 100644 --- a/src/main/kotlin/com/epam/brn/service/statistic/progress/status/UserRestTimeRetriever.kt +++ b/src/main/kotlin/com/epam/brn/service/statistics/progress/status/UserRestTimeRetriever.kt @@ -1,4 +1,4 @@ -package com.epam.brn.service.statistic.progress.status +package com.epam.brn.service.statistics.progress.status import java.time.LocalDate diff --git a/src/main/kotlin/com/epam/brn/service/statistic/progress/status/impl/StudyHistoriesProgressStatusManager.kt b/src/main/kotlin/com/epam/brn/service/statistics/progress/status/impl/StudyHistoriesProgressStatusManager.kt similarity index 63% rename from src/main/kotlin/com/epam/brn/service/statistic/progress/status/impl/StudyHistoriesProgressStatusManager.kt rename to src/main/kotlin/com/epam/brn/service/statistics/progress/status/impl/StudyHistoriesProgressStatusManager.kt index 90639869a..dcae5c226 100644 --- a/src/main/kotlin/com/epam/brn/service/statistic/progress/status/impl/StudyHistoriesProgressStatusManager.kt +++ b/src/main/kotlin/com/epam/brn/service/statistics/progress/status/impl/StudyHistoriesProgressStatusManager.kt @@ -1,10 +1,10 @@ -package com.epam.brn.service.statistic.progress.status.impl +package com.epam.brn.service.statistics.progress.status.impl -import com.epam.brn.dto.statistic.UserExercisingPeriod -import com.epam.brn.dto.statistic.UserExercisingProgressStatus +import com.epam.brn.dto.statistics.UserExercisingPeriod +import com.epam.brn.dto.statistics.UserExercisingProgressStatus import com.epam.brn.model.StudyHistory -import com.epam.brn.service.statistic.progress.status.ExercisingStatusRetriever -import com.epam.brn.service.statistic.progress.status.ProgressStatusManager +import com.epam.brn.service.statistics.progress.status.ExercisingStatusRetriever +import com.epam.brn.service.statistics.progress.status.ProgressStatusManager import org.springframework.stereotype.Service @Service diff --git a/src/main/kotlin/com/epam/brn/service/statistic/progress/status/impl/UserRestTimeRetrieverImpl.kt b/src/main/kotlin/com/epam/brn/service/statistics/progress/status/impl/UserRestTimeRetrieverImpl.kt similarity index 90% rename from src/main/kotlin/com/epam/brn/service/statistic/progress/status/impl/UserRestTimeRetrieverImpl.kt rename to src/main/kotlin/com/epam/brn/service/statistics/progress/status/impl/UserRestTimeRetrieverImpl.kt index 76c88f4da..70af891ca 100644 --- a/src/main/kotlin/com/epam/brn/service/statistic/progress/status/impl/UserRestTimeRetrieverImpl.kt +++ b/src/main/kotlin/com/epam/brn/service/statistics/progress/status/impl/UserRestTimeRetrieverImpl.kt @@ -1,9 +1,9 @@ -package com.epam.brn.service.statistic.progress.status.impl +package com.epam.brn.service.statistics.progress.status.impl import com.epam.brn.model.StudyHistory import com.epam.brn.repo.StudyHistoryRepository import com.epam.brn.service.UserAccountService -import com.epam.brn.service.statistic.progress.status.UserRestTimeRetriever +import com.epam.brn.service.statistics.progress.status.UserRestTimeRetriever import org.springframework.stereotype.Component import java.time.LocalDate import java.time.temporal.ChronoUnit diff --git a/src/main/kotlin/com/epam/brn/service/statistic/progress/status/impl/retriever/DayExercisingStatusRetriever.kt b/src/main/kotlin/com/epam/brn/service/statistics/progress/status/impl/retriever/DayExercisingStatusRetriever.kt similarity index 64% rename from src/main/kotlin/com/epam/brn/service/statistic/progress/status/impl/retriever/DayExercisingStatusRetriever.kt rename to src/main/kotlin/com/epam/brn/service/statistics/progress/status/impl/retriever/DayExercisingStatusRetriever.kt index 8abe2c03f..7fe2172f1 100644 --- a/src/main/kotlin/com/epam/brn/service/statistic/progress/status/impl/retriever/DayExercisingStatusRetriever.kt +++ b/src/main/kotlin/com/epam/brn/service/statistics/progress/status/impl/retriever/DayExercisingStatusRetriever.kt @@ -1,10 +1,10 @@ -package com.epam.brn.service.statistic.progress.status.impl.retriever +package com.epam.brn.service.statistics.progress.status.impl.retriever -import com.epam.brn.dto.statistic.UserExercisingPeriod -import com.epam.brn.dto.statistic.UserExercisingProgressStatus +import com.epam.brn.dto.statistics.UserExercisingPeriod +import com.epam.brn.dto.statistics.UserExercisingProgressStatus import com.epam.brn.model.StudyHistory -import com.epam.brn.service.statistic.progress.status.ExercisingStatusRetriever -import com.epam.brn.service.statistic.progress.status.requirements.StatusRequirementsManager +import com.epam.brn.service.statistics.progress.status.ExercisingStatusRetriever +import com.epam.brn.service.statistics.progress.status.requirements.StatusRequirementsManager import org.springframework.stereotype.Component @Component @@ -13,7 +13,7 @@ class DayExercisingStatusRetriever( ) : ExercisingStatusRetriever> { override fun getStatus(progress: List): UserExercisingProgressStatus? { val periodRequirements = requirementsManager.getPeriodRequirements(UserExercisingPeriod.DAY) - val sumOfHistory = progress.sumBy { it.executionSeconds } + val sumOfHistory = progress.sumOf { it.executionSeconds } return periodRequirements.firstOrNull { requirements -> sumOfHistory in requirements.minimalRequirements * 60 until requirements.maximalRequirements * 60 }?.status diff --git a/src/main/kotlin/com/epam/brn/service/statistic/progress/status/impl/retriever/WeekExercisingStatusRetriever.kt b/src/main/kotlin/com/epam/brn/service/statistics/progress/status/impl/retriever/WeekExercisingStatusRetriever.kt similarity index 73% rename from src/main/kotlin/com/epam/brn/service/statistic/progress/status/impl/retriever/WeekExercisingStatusRetriever.kt rename to src/main/kotlin/com/epam/brn/service/statistics/progress/status/impl/retriever/WeekExercisingStatusRetriever.kt index 68085c4fc..1b5f4a60b 100644 --- a/src/main/kotlin/com/epam/brn/service/statistic/progress/status/impl/retriever/WeekExercisingStatusRetriever.kt +++ b/src/main/kotlin/com/epam/brn/service/statistics/progress/status/impl/retriever/WeekExercisingStatusRetriever.kt @@ -1,11 +1,11 @@ -package com.epam.brn.service.statistic.progress.status.impl.retriever +package com.epam.brn.service.statistics.progress.status.impl.retriever -import com.epam.brn.dto.statistic.UserExercisingPeriod -import com.epam.brn.dto.statistic.UserExercisingProgressStatus +import com.epam.brn.dto.statistics.UserExercisingPeriod +import com.epam.brn.dto.statistics.UserExercisingProgressStatus import com.epam.brn.model.StudyHistory -import com.epam.brn.service.statistic.progress.status.ExercisingStatusRetriever -import com.epam.brn.service.statistic.progress.status.UserRestTimeRetriever -import com.epam.brn.service.statistic.progress.status.requirements.StatusRequirementsManager +import com.epam.brn.service.statistics.progress.status.ExercisingStatusRetriever +import com.epam.brn.service.statistics.progress.status.UserRestTimeRetriever +import com.epam.brn.service.statistics.progress.status.requirements.StatusRequirementsManager import org.springframework.stereotype.Component @Component diff --git a/src/main/kotlin/com/epam/brn/service/statistic/progress/status/requirements/StatusRequirementsManager.kt b/src/main/kotlin/com/epam/brn/service/statistics/progress/status/requirements/StatusRequirementsManager.kt similarity index 67% rename from src/main/kotlin/com/epam/brn/service/statistic/progress/status/requirements/StatusRequirementsManager.kt rename to src/main/kotlin/com/epam/brn/service/statistics/progress/status/requirements/StatusRequirementsManager.kt index a5cba41e0..2b6aec72b 100644 --- a/src/main/kotlin/com/epam/brn/service/statistic/progress/status/requirements/StatusRequirementsManager.kt +++ b/src/main/kotlin/com/epam/brn/service/statistics/progress/status/requirements/StatusRequirementsManager.kt @@ -1,7 +1,7 @@ -package com.epam.brn.service.statistic.progress.status.requirements +package com.epam.brn.service.statistics.progress.status.requirements -import com.epam.brn.dto.statistic.StatusRequirements -import com.epam.brn.dto.statistic.UserExercisingPeriod +import com.epam.brn.dto.statistics.StatusRequirements +import com.epam.brn.dto.statistics.UserExercisingPeriod /** *@author Nikolai Lazarev diff --git a/src/main/kotlin/com/epam/brn/service/statistic/progress/status/requirements/StatusRequirementsRetriever.kt b/src/main/kotlin/com/epam/brn/service/statistics/progress/status/requirements/StatusRequirementsRetriever.kt similarity index 69% rename from src/main/kotlin/com/epam/brn/service/statistic/progress/status/requirements/StatusRequirementsRetriever.kt rename to src/main/kotlin/com/epam/brn/service/statistics/progress/status/requirements/StatusRequirementsRetriever.kt index bcbe53341..a40fbe45b 100644 --- a/src/main/kotlin/com/epam/brn/service/statistic/progress/status/requirements/StatusRequirementsRetriever.kt +++ b/src/main/kotlin/com/epam/brn/service/statistics/progress/status/requirements/StatusRequirementsRetriever.kt @@ -1,8 +1,8 @@ -package com.epam.brn.service.statistic.progress.status.requirements +package com.epam.brn.service.statistics.progress.status.requirements -import com.epam.brn.dto.statistic.StatusRequirements -import com.epam.brn.dto.statistic.UserExercisingPeriod -import com.epam.brn.dto.statistic.UserExercisingProgressStatus +import com.epam.brn.dto.statistics.StatusRequirements +import com.epam.brn.dto.statistics.UserExercisingPeriod +import com.epam.brn.dto.statistics.UserExercisingProgressStatus /** *@author Nikolai Lazarev diff --git a/src/main/kotlin/com/epam/brn/service/statistic/progress/status/requirements/impl/ApplicationPropertiesRequirementsRetriever.kt b/src/main/kotlin/com/epam/brn/service/statistics/progress/status/requirements/impl/ApplicationPropertiesRequirementsRetriever.kt similarity index 71% rename from src/main/kotlin/com/epam/brn/service/statistic/progress/status/requirements/impl/ApplicationPropertiesRequirementsRetriever.kt rename to src/main/kotlin/com/epam/brn/service/statistics/progress/status/requirements/impl/ApplicationPropertiesRequirementsRetriever.kt index b8e0e435d..88332c644 100644 --- a/src/main/kotlin/com/epam/brn/service/statistic/progress/status/requirements/impl/ApplicationPropertiesRequirementsRetriever.kt +++ b/src/main/kotlin/com/epam/brn/service/statistics/progress/status/requirements/impl/ApplicationPropertiesRequirementsRetriever.kt @@ -1,9 +1,9 @@ -package com.epam.brn.service.statistic.progress.status.requirements.impl +package com.epam.brn.service.statistics.progress.status.requirements.impl -import com.epam.brn.dto.statistic.StatusRequirements -import com.epam.brn.dto.statistic.UserExercisingPeriod -import com.epam.brn.dto.statistic.UserExercisingProgressStatus -import com.epam.brn.service.statistic.progress.status.requirements.StatusRequirementsRetriever +import com.epam.brn.dto.statistics.StatusRequirements +import com.epam.brn.dto.statistics.UserExercisingPeriod +import com.epam.brn.dto.statistics.UserExercisingProgressStatus +import com.epam.brn.service.statistics.progress.status.requirements.StatusRequirementsRetriever import org.springframework.core.env.Environment import org.springframework.stereotype.Component import javax.naming.OperationNotSupportedException @@ -23,10 +23,10 @@ class ApplicationPropertiesRequirementsRetriever( val periodName = period.name.toLowerCase() val statusName = status.name.toLowerCase() return StatusRequirements( - maximalRequirements = environment.getProperty("brn.statistic.progress.$periodName.status.$statusName.maximal") + maximalRequirements = environment.getProperty("brn.statistics.progress.$periodName.status.$statusName.maximal") ?.toInt() ?: throw OperationNotSupportedException("Maximal requirements for period: $periodName or status: $statusName are not supported yet"), - minimalRequirements = environment.getProperty("brn.statistic.progress.$periodName.status.$statusName.minimal") + minimalRequirements = environment.getProperty("brn.statistics.progress.$periodName.status.$statusName.minimal") ?.toInt() ?: throw OperationNotSupportedException("Minimal requirements for period: $periodName or status: $statusName are not supported yet"), status = status diff --git a/src/main/kotlin/com/epam/brn/service/statistic/progress/status/requirements/impl/StatusRequirementsManagerImpl.kt b/src/main/kotlin/com/epam/brn/service/statistics/progress/status/requirements/impl/StatusRequirementsManagerImpl.kt similarity index 52% rename from src/main/kotlin/com/epam/brn/service/statistic/progress/status/requirements/impl/StatusRequirementsManagerImpl.kt rename to src/main/kotlin/com/epam/brn/service/statistics/progress/status/requirements/impl/StatusRequirementsManagerImpl.kt index eb56cff9a..8dc522753 100644 --- a/src/main/kotlin/com/epam/brn/service/statistic/progress/status/requirements/impl/StatusRequirementsManagerImpl.kt +++ b/src/main/kotlin/com/epam/brn/service/statistics/progress/status/requirements/impl/StatusRequirementsManagerImpl.kt @@ -1,10 +1,10 @@ -package com.epam.brn.service.statistic.progress.status.requirements.impl +package com.epam.brn.service.statistics.progress.status.requirements.impl -import com.epam.brn.dto.statistic.StatusRequirements -import com.epam.brn.dto.statistic.UserExercisingPeriod -import com.epam.brn.dto.statistic.UserExercisingProgressStatus -import com.epam.brn.service.statistic.progress.status.requirements.StatusRequirementsManager -import com.epam.brn.service.statistic.progress.status.requirements.StatusRequirementsRetriever +import com.epam.brn.dto.statistics.StatusRequirements +import com.epam.brn.dto.statistics.UserExercisingPeriod +import com.epam.brn.dto.statistics.UserExercisingProgressStatus +import com.epam.brn.service.statistics.progress.status.requirements.StatusRequirementsManager +import com.epam.brn.service.statistics.progress.status.requirements.StatusRequirementsRetriever import org.springframework.stereotype.Service /** diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index b9779f49c..0292567fc 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -95,20 +95,20 @@ brn.resources.pictures.update-job.cron = 0 0 0 1 * * #brn.resources.pictures.update-job.cron = 0 0/1 * * * ? brn.dataFormatNumLines=5 -brn.statistic.progress.day.status.bad.minimal=0 -brn.statistic.progress.day.status.bad.maximal=15 -brn.statistic.progress.day.status.good.minimal=15 -brn.statistic.progress.day.status.good.maximal=20 -brn.statistic.progress.day.status.great.minimal=20 -brn.statistic.progress.day.status.great.maximal=1440 - -brn.statistic.progress.week.status.bad.minimal=0 -brn.statistic.progress.week.status.bad.maximal=5 - -brn.statistic.progress.week.status.good.minimal=5 -brn.statistic.progress.week.status.good.maximal=6 -brn.statistic.progress.week.status.great.minimal=6 -brn.statistic.progress.week.status.great.maximal=8 +brn.statistics.progress.day.status.bad.minimal=0 +brn.statistics.progress.day.status.bad.maximal=15 +brn.statistics.progress.day.status.good.minimal=15 +brn.statistics.progress.day.status.good.maximal=20 +brn.statistics.progress.day.status.great.minimal=20 +brn.statistics.progress.day.status.great.maximal=1440 + +brn.statistics.progress.week.status.bad.minimal=0 +brn.statistics.progress.week.status.bad.maximal=5 + +brn.statistics.progress.week.status.good.minimal=5 +brn.statistics.progress.week.status.good.maximal=6 +brn.statistics.progress.week.status.great.minimal=6 +brn.statistics.progress.week.status.great.maximal=8 fonAudioPath=/audio/fon/%s.mp3 diff --git a/src/test/kotlin/com/epam/brn/controller/UserDetailControllerTest.kt b/src/test/kotlin/com/epam/brn/controller/UserDetailControllerTest.kt index 54ee03587..2e5087d15 100644 --- a/src/test/kotlin/com/epam/brn/controller/UserDetailControllerTest.kt +++ b/src/test/kotlin/com/epam/brn/controller/UserDetailControllerTest.kt @@ -281,7 +281,7 @@ internal class UserDetailControllerTest { } @Test - fun `getUsers should return users with statistic when withAnalytics is true`() { + fun `getUsers should return users with statistics when withAnalytics is true`() { // GIVEN val withAnalytics = true val role = BrnRole.USER diff --git a/src/test/kotlin/com/epam/brn/controller/UserStatisticControllerV2Test.kt b/src/test/kotlin/com/epam/brn/controller/UserStatisticsControllerV2Test.kt similarity index 73% rename from src/test/kotlin/com/epam/brn/controller/UserStatisticControllerV2Test.kt rename to src/test/kotlin/com/epam/brn/controller/UserStatisticsControllerV2Test.kt index 5c7c78892..d4485690d 100644 --- a/src/test/kotlin/com/epam/brn/controller/UserStatisticControllerV2Test.kt +++ b/src/test/kotlin/com/epam/brn/controller/UserStatisticsControllerV2Test.kt @@ -2,11 +2,11 @@ package com.epam.brn.controller import com.epam.brn.service.RoleService import com.epam.brn.dto.response.BrnResponse -import com.epam.brn.dto.statistic.DayStudyStatistic -import com.epam.brn.dto.statistic.MonthStudyStatistic -import com.epam.brn.dto.statistic.UserDailyDetailStatisticsDto +import com.epam.brn.dto.statistics.DayStudyStatistics +import com.epam.brn.dto.statistics.MonthStudyStatistics +import com.epam.brn.dto.statistics.UserDailyDetailStatisticsDto import com.epam.brn.service.StudyHistoryService -import com.epam.brn.service.statistic.UserPeriodStatisticService +import com.epam.brn.service.statistics.UserPeriodStatisticsService import io.kotest.matchers.shouldBe import io.mockk.every import io.mockk.impl.annotations.InjectMockKs @@ -23,16 +23,16 @@ import kotlin.test.assertEquals @ExtendWith(MockKExtension::class) @DisplayName("UserStatisticControllerV2 test using MockK") -internal class UserStatisticControllerV2Test { +internal class UserStatisticsControllerV2Test { @InjectMockKs private lateinit var userStatisticControllerV2: UserStatisticControllerV2 @MockK - private lateinit var userDayStatisticService: UserPeriodStatisticService + private lateinit var userDayStatisticService: UserPeriodStatisticsService @MockK - private lateinit var userMonthStatisticService: UserPeriodStatisticService + private lateinit var userMonthStatisticService: UserPeriodStatisticsService @MockK private lateinit var studyHistoryService: StudyHistoryService @@ -41,45 +41,45 @@ internal class UserStatisticControllerV2Test { private lateinit var roleService: RoleService @Test - fun `should get user weekly statistic`() { + fun `should get user weekly statistics`() { // GIVEN - val dayStudyStatistic = mockk() + val dayStudyStatistics = mockk() val from = LocalDateTime.of(2021, 5, 1, 0, 0) val to = LocalDateTime.of(2021, 6, 5, 23, 59) - val dayStudyStatisticList = listOf(dayStudyStatistic) + val dayStudyStatisticList = listOf(dayStudyStatistics) // WHEN - every { userDayStatisticService.getStatisticForPeriod(from, to) } returns dayStudyStatisticList - val userWeeklyStatistic = userStatisticControllerV2.getUserWeeklyStatistic(from, to, null) + every { userDayStatisticService.getStatisticsForPeriod(from, to) } returns dayStudyStatisticList + val userWeeklyStatistic = userStatisticControllerV2.getUserWeeklyStatistics(from, to, null) // THEN - verify(exactly = 1) { userDayStatisticService.getStatisticForPeriod(from, to) } + verify(exactly = 1) { userDayStatisticService.getStatisticsForPeriod(from, to) } assertEquals(HttpStatus.SC_OK, userWeeklyStatistic.statusCodeValue) assertEquals(dayStudyStatisticList, (userWeeklyStatistic.body as BrnResponse).data) } @Test - fun `should get user yearly statistic`() { + fun `should get user yearly statistics`() { // GIVEN - val monthStudyStatistic = mockk() + val monthStudyStatistics = mockk() val from = LocalDateTime.of(2021, 5, 1, 0, 0) val to = LocalDateTime.of(2021, 6, 5, 23, 59) - val monthStudyStatisticList = listOf(monthStudyStatistic) + val monthStudyStatisticList = listOf(monthStudyStatistics) // WHEN - every { userMonthStatisticService.getStatisticForPeriod(from, to) } returns monthStudyStatisticList - val userYearlyStatistic = userStatisticControllerV2.getUserYearlyStatistic(from, to, null) + every { userMonthStatisticService.getStatisticsForPeriod(from, to) } returns monthStudyStatisticList + val userYearlyStatistic = userStatisticControllerV2.getUserYearlyStatistics(from, to, null) // THEN - verify(exactly = 1) { userMonthStatisticService.getStatisticForPeriod(from, to) } + verify(exactly = 1) { userMonthStatisticService.getStatisticsForPeriod(from, to) } assertEquals(HttpStatus.SC_OK, userYearlyStatistic.statusCodeValue) assertEquals(monthStudyStatisticList, (userYearlyStatistic.body as BrnResponse).data) } @Test - fun `getUserWeeklyStatistic should return daily details statistic`() { + fun `getUserWeeklyStatistic should return daily details statistics`() { // GIVEN val date = LocalDateTime.now() val userDailyDetailStatisticsDto = mockk() @@ -95,49 +95,49 @@ internal class UserStatisticControllerV2Test { } @Test - fun `getUserWeeklyStatistic should return weekly statistic for admin`() { + fun `getUserWeeklyStatistic should return weekly statistics for admin`() { // GIVEN val userId = 1L val date = LocalDateTime.now() - val dayStudyStatistic = mockk() - every { userDayStatisticService.getStatisticForPeriod(date, date, userId) } returns listOf(dayStudyStatistic) + val dayStudyStatistics = mockk() + every { userDayStatisticService.getStatisticsForPeriod(date, date, userId) } returns listOf(dayStudyStatistics) every { roleService.isCurrentUserAdmin() } returns true // WHEN - val userWeeklyStatistic = userStatisticControllerV2.getUserWeeklyStatistic(date, date, userId) + val userWeeklyStatistic = userStatisticControllerV2.getUserWeeklyStatistics(date, date, userId) // THEN - verify(exactly = 1) { userDayStatisticService.getStatisticForPeriod(date, date, userId) } + verify(exactly = 1) { userDayStatisticService.getStatisticsForPeriod(date, date, userId) } userWeeklyStatistic.statusCodeValue shouldBe HttpStatus.SC_OK - userWeeklyStatistic.body!!.data shouldBe listOf(dayStudyStatistic) + userWeeklyStatistic.body!!.data shouldBe listOf(dayStudyStatistics) } @Test - fun `getUserYearlyStatistic should return yearly statistic for admin`() { + fun `getUserYearlyStatistic should return yearly statistics for admin`() { // GIVEN val userId = 1L val date = LocalDateTime.now() - val monthStudyStatistic = mockk() + val monthStudyStatistics = mockk() every { - userMonthStatisticService.getStatisticForPeriod( + userMonthStatisticService.getStatisticsForPeriod( date, date, userId ) - } returns listOf(monthStudyStatistic) + } returns listOf(monthStudyStatistics) every { roleService.isCurrentUserAdmin() } returns true // WHEN - val userYearlyStatistic = userStatisticControllerV2.getUserYearlyStatistic(date, date, userId) + val userYearlyStatistic = userStatisticControllerV2.getUserYearlyStatistics(date, date, userId) // THEN - verify(exactly = 1) { userMonthStatisticService.getStatisticForPeriod(date, date, userId) } + verify(exactly = 1) { userMonthStatisticService.getStatisticsForPeriod(date, date, userId) } userYearlyStatistic.statusCodeValue shouldBe HttpStatus.SC_OK - userYearlyStatistic.body!!.data shouldBe listOf(monthStudyStatistic) + userYearlyStatistic.body!!.data shouldBe listOf(monthStudyStatistics) } @Test - fun `getUserWeeklyStatistic should return daily details statistic for admin`() { + fun `getUserWeeklyStatistic should return daily details statistics for admin`() { // GIVEN val userId = 1L val date = LocalDateTime.now() diff --git a/src/test/kotlin/com/epam/brn/controller/UserSubGroupStatisticControllerTest.kt b/src/test/kotlin/com/epam/brn/controller/UserSubGroupStatisticsControllerTest.kt similarity index 74% rename from src/test/kotlin/com/epam/brn/controller/UserSubGroupStatisticControllerTest.kt rename to src/test/kotlin/com/epam/brn/controller/UserSubGroupStatisticsControllerTest.kt index fa31a943a..68eb0709a 100644 --- a/src/test/kotlin/com/epam/brn/controller/UserSubGroupStatisticControllerTest.kt +++ b/src/test/kotlin/com/epam/brn/controller/UserSubGroupStatisticsControllerTest.kt @@ -1,11 +1,11 @@ package com.epam.brn.controller import com.epam.brn.dto.response.BrnResponse -import com.epam.brn.dto.response.SubGroupStatisticResponse -import com.epam.brn.dto.statistic.DayStudyStatistic -import com.epam.brn.dto.statistic.MonthStudyStatistic -import com.epam.brn.service.statistic.UserPeriodStatisticService -import com.epam.brn.service.statistic.UserStatisticService +import com.epam.brn.dto.response.SubGroupStatisticsResponse +import com.epam.brn.dto.statistics.DayStudyStatistics +import com.epam.brn.dto.statistics.MonthStudyStatistics +import com.epam.brn.service.statistics.UserPeriodStatisticsService +import com.epam.brn.service.statistics.UserStatisticService import io.mockk.every import io.mockk.impl.annotations.InjectMockKs import io.mockk.impl.annotations.MockK @@ -19,25 +19,25 @@ import kotlin.test.assertEquals @ExtendWith(MockKExtension::class) @DisplayName("UserStatisticController test using MockK") -internal class UserSubGroupStatisticControllerTest { +internal class UserSubGroupStatisticsControllerTest { @InjectMockKs private lateinit var userStatisticController: UserSubGroupStatisticController @MockK - private lateinit var userStatisticService: UserStatisticService + private lateinit var userStatisticService: UserStatisticService @MockK - private lateinit var userDayStatisticService: UserPeriodStatisticService + private lateinit var userDayStatisticService: UserPeriodStatisticsService @MockK - private lateinit var userMonthStatisticService: UserPeriodStatisticService + private lateinit var userMonthStatisticService: UserPeriodStatisticsService @MockK - private lateinit var subGroupStatisticResponse: SubGroupStatisticResponse + private lateinit var subGroupStatisticResponse: SubGroupStatisticsResponse @Test - fun `should get user sub group statistic`() { + fun `should get user sub group statistics`() { // GIVEN val subGroupStatisticDtoList = listOf(subGroupStatisticResponse) val ids = listOf(1L, 2L, 3L) diff --git a/src/test/kotlin/com/epam/brn/integration/UserSubGroupStatisticControllerIT.kt b/src/test/kotlin/com/epam/brn/integration/UserSubGroupStatisticsControllerIT.kt similarity index 93% rename from src/test/kotlin/com/epam/brn/integration/UserSubGroupStatisticControllerIT.kt rename to src/test/kotlin/com/epam/brn/integration/UserSubGroupStatisticsControllerIT.kt index de64fee08..72ac95cbe 100644 --- a/src/test/kotlin/com/epam/brn/integration/UserSubGroupStatisticControllerIT.kt +++ b/src/test/kotlin/com/epam/brn/integration/UserSubGroupStatisticsControllerIT.kt @@ -1,7 +1,7 @@ package com.epam.brn.integration import com.epam.brn.dto.response.BrnResponse -import com.epam.brn.dto.response.SubGroupStatisticResponse +import com.epam.brn.dto.response.SubGroupStatisticsResponse import com.epam.brn.enums.BrnRole import com.epam.brn.model.Exercise import com.epam.brn.repo.ExerciseRepository @@ -19,7 +19,7 @@ import java.nio.charset.StandardCharsets import java.time.format.DateTimeFormatter @WithMockUser(username = "test@test.test", roles = [BrnRole.USER]) -class UserSubGroupStatisticControllerIT : BaseIT() { +class UserSubGroupStatisticsControllerIT : BaseIT() { @Autowired private lateinit var exerciseRepository: ExerciseRepository @@ -78,8 +78,8 @@ class UserSubGroupStatisticControllerIT : BaseIT() { val baseResponse = objectMapper.readValue(response, BrnResponse::class.java) val baseResponseJson = gson.toJson(baseResponse.data) - val resultStatistic: List = - objectMapper.readValue(baseResponseJson, object : TypeReference>() {}) + val resultStatistic: List = + objectMapper.readValue(baseResponseJson, object : TypeReference>() {}) // THEN assertEquals(1, resultStatistic.first().totalExercises) diff --git a/src/test/kotlin/com/epam/brn/integration/UserSubGroupStatisticControllerV2IT.kt b/src/test/kotlin/com/epam/brn/integration/UserSubGroupStatisticsControllerV2IT.kt similarity index 92% rename from src/test/kotlin/com/epam/brn/integration/UserSubGroupStatisticControllerV2IT.kt rename to src/test/kotlin/com/epam/brn/integration/UserSubGroupStatisticsControllerV2IT.kt index a9aa94292..6ee1a9356 100644 --- a/src/test/kotlin/com/epam/brn/integration/UserSubGroupStatisticControllerV2IT.kt +++ b/src/test/kotlin/com/epam/brn/integration/UserSubGroupStatisticsControllerV2IT.kt @@ -1,9 +1,9 @@ package com.epam.brn.integration import com.epam.brn.dto.response.BrnResponse -import com.epam.brn.dto.statistic.DayStudyStatistic -import com.epam.brn.dto.statistic.MonthStudyStatistic -import com.epam.brn.dto.statistic.UserDailyDetailStatisticsDto +import com.epam.brn.dto.statistics.DayStudyStatistics +import com.epam.brn.dto.statistics.MonthStudyStatistics +import com.epam.brn.dto.statistics.UserDailyDetailStatisticsDto import com.epam.brn.enums.BrnRole import com.fasterxml.jackson.core.type.TypeReference import io.kotest.matchers.shouldBe @@ -19,7 +19,7 @@ import java.time.format.DateTimeFormatter import kotlin.test.assertNotNull @WithMockUser(username = "test@test.test", roles = [BrnRole.USER]) -class UserSubGroupStatisticControllerV2IT : BaseIT() { +class UserSubGroupStatisticsControllerV2IT : BaseIT() { private val baseUrl = "/v2/statistics" private val exercisingYear = 2020 @@ -34,7 +34,7 @@ class UserSubGroupStatisticControllerV2IT : BaseIT() { } @Test @WithMockUser(username = "test@test.test", roles = [BrnRole.USER]) - fun `should return user statistic for days API version 2`() { + fun `should return user statistics for days API version 2`() { // GIVEN val user = insertDefaultUser() val exercise = insertDefaultExercise() @@ -55,8 +55,8 @@ class UserSubGroupStatisticControllerV2IT : BaseIT() { .andReturn().response.getContentAsString(StandardCharsets.UTF_8) val data = objectMapper.readValue(response, BrnResponse::class.java).data - val resultStatistic: List = - objectMapper.readValue(objectMapper.writeValueAsString(data), object : TypeReference>() {}) + val resultStatistic: List = + objectMapper.readValue(objectMapper.writeValueAsString(data), object : TypeReference>() {}) // THEN Assertions.assertEquals(3, resultStatistic.size) @@ -67,7 +67,7 @@ class UserSubGroupStatisticControllerV2IT : BaseIT() { } @Test @WithMockUser(username = "test@test.test", roles = [BrnRole.USER]) - fun `should return user statistic for days API version 2 for user with role user`() { + fun `should return user statistics for days API version 2 for user with role user`() { // GIVEN val user = insertDefaultUser() val exercise = insertDefaultExercise() @@ -88,8 +88,8 @@ class UserSubGroupStatisticControllerV2IT : BaseIT() { .andReturn().response.getContentAsString(StandardCharsets.UTF_8) val data = objectMapper.readValue(response, BrnResponse::class.java).data - val resultStatistic: List = - objectMapper.readValue(objectMapper.writeValueAsString(data), object : TypeReference>() {}) + val resultStatistic: List = + objectMapper.readValue(objectMapper.writeValueAsString(data), object : TypeReference>() {}) // THEN Assertions.assertEquals(3, resultStatistic.size) @@ -100,7 +100,7 @@ class UserSubGroupStatisticControllerV2IT : BaseIT() { } @Test @WithMockUser(username = "test@test.test", roles = [BrnRole.USER]) - fun `should return user statistic for month API version 2`() { + fun `should return user statistics for month API version 2`() { // GIVEN val user = insertDefaultUser() val exercise = insertDefaultExercise() @@ -122,8 +122,8 @@ class UserSubGroupStatisticControllerV2IT : BaseIT() { .andReturn().response.getContentAsString(StandardCharsets.UTF_8) val data = objectMapper.readValue(response, BrnResponse::class.java).data - val resultStatistic: List = - objectMapper.readValue(objectMapper.writeValueAsString(data), object : TypeReference>() {}) + val resultStatistic: List = + objectMapper.readValue(objectMapper.writeValueAsString(data), object : TypeReference>() {}) // THEN Assertions.assertEquals(1, resultStatistic.size) @@ -135,7 +135,7 @@ class UserSubGroupStatisticControllerV2IT : BaseIT() { @Test @WithMockUser(username = "test@test.test", roles = [BrnRole.USER]) - fun `should return user statistic for month API version 2 for user with role user`() { + fun `should return user statistics for month API version 2 for user with role user`() { // GIVEN val user = insertDefaultUser() val exercise = insertDefaultExercise() @@ -157,8 +157,8 @@ class UserSubGroupStatisticControllerV2IT : BaseIT() { .andReturn().response.getContentAsString(StandardCharsets.UTF_8) val data = objectMapper.readValue(response, BrnResponse::class.java).data - val resultStatistic: List = - objectMapper.readValue(objectMapper.writeValueAsString(data), object : TypeReference>() {}) + val resultStatistic: List = + objectMapper.readValue(objectMapper.writeValueAsString(data), object : TypeReference>() {}) // THEN Assertions.assertEquals(1, resultStatistic.size) @@ -170,7 +170,7 @@ class UserSubGroupStatisticControllerV2IT : BaseIT() { @Test @WithMockUser(username = "test@test.test", roles = [BrnRole.USER]) - fun `should return user daily details statistic`() { + fun `should return user daily details statistics`() { // GIVEN val seriesName1 = "seriesName1" val seriesName2 = "seriesName2" @@ -191,7 +191,7 @@ class UserSubGroupStatisticControllerV2IT : BaseIT() { insertDefaultStudyHistory(user, exercise3, LocalDateTime.of(exercisingYear, exercisingMonth, 1, 14, 0), 25, 3, 0, 1) insertDefaultStudyHistory(user, exercise3, LocalDateTime.of(exercisingYear, exercisingMonth, 1, 15, 0), 25, 3, 0, 0) insertDefaultStudyHistory(user, exercise4, LocalDateTime.of(exercisingYear, exercisingMonth, 1, 16, 0), 30, 5, 5, 5) - // statistic for other days + // statistics for other days insertDefaultStudyHistory(user, exercise3, LocalDateTime.of(exercisingYear, exercisingMonth, 2, 15, 0), 25, 3, 0, 0) insertDefaultStudyHistory(user, exercise1, LocalDateTime.of(exercisingYear, exercisingMonth, 3, 13, 0), 5, 2, 1, 1) @@ -231,7 +231,7 @@ class UserSubGroupStatisticControllerV2IT : BaseIT() { @Test @WithMockUser(username = "test@test.test", roles = [BrnRole.USER]) - fun `should return user daily details statistic for user with role user`() { + fun `should return user daily details statistics for user with role user`() { // GIVEN val seriesName1 = "seriesName1" val seriesName2 = "seriesName2" @@ -252,7 +252,7 @@ class UserSubGroupStatisticControllerV2IT : BaseIT() { insertDefaultStudyHistory(user, exercise3, LocalDateTime.of(exercisingYear, exercisingMonth, 1, 14, 0), 25, 3, 0, 1) insertDefaultStudyHistory(user, exercise3, LocalDateTime.of(exercisingYear, exercisingMonth, 1, 15, 0), 25, 3, 0, 0) insertDefaultStudyHistory(user, exercise4, LocalDateTime.of(exercisingYear, exercisingMonth, 1, 16, 0), 30, 5, 5, 5) - // statistic for other days + // statistics for other days insertDefaultStudyHistory(user, exercise3, LocalDateTime.of(exercisingYear, exercisingMonth, 2, 15, 0), 25, 3, 0, 0) insertDefaultStudyHistory(user, exercise1, LocalDateTime.of(exercisingYear, exercisingMonth, 3, 13, 0), 5, 2, 1, 1) diff --git a/src/test/kotlin/com/epam/brn/integration/service/statistic/requirements/impl/StatusRequirementsManagerImplIT.kt b/src/test/kotlin/com/epam/brn/integration/service/statistics/requirements/impl/StatusRequirementsManagerImplIT.kt similarity index 80% rename from src/test/kotlin/com/epam/brn/integration/service/statistic/requirements/impl/StatusRequirementsManagerImplIT.kt rename to src/test/kotlin/com/epam/brn/integration/service/statistics/requirements/impl/StatusRequirementsManagerImplIT.kt index 11ccc398c..5d24daf61 100644 --- a/src/test/kotlin/com/epam/brn/integration/service/statistic/requirements/impl/StatusRequirementsManagerImplIT.kt +++ b/src/test/kotlin/com/epam/brn/integration/service/statistics/requirements/impl/StatusRequirementsManagerImplIT.kt @@ -1,10 +1,10 @@ -package com.epam.brn.integration.service.statistic.requirements.impl +package com.epam.brn.integration.service.statistics.requirements.impl -import com.epam.brn.dto.statistic.StatusRequirements -import com.epam.brn.dto.statistic.UserExercisingPeriod -import com.epam.brn.dto.statistic.UserExercisingProgressStatus +import com.epam.brn.dto.statistics.StatusRequirements +import com.epam.brn.dto.statistics.UserExercisingPeriod +import com.epam.brn.dto.statistics.UserExercisingProgressStatus import com.epam.brn.integration.BaseIT -import com.epam.brn.service.statistic.progress.status.requirements.impl.StatusRequirementsManagerImpl +import com.epam.brn.service.statistics.progress.status.requirements.impl.StatusRequirementsManagerImpl import org.junit.jupiter.api.Test import org.springframework.beans.factory.annotation.Autowired import kotlin.test.assertEquals diff --git a/src/test/kotlin/com/epam/brn/service/StudyHistoryServiceTest.kt b/src/test/kotlin/com/epam/brn/service/StudyHistoryServiceTest.kt index 4da51de5c..18243abfb 100644 --- a/src/test/kotlin/com/epam/brn/service/StudyHistoryServiceTest.kt +++ b/src/test/kotlin/com/epam/brn/service/StudyHistoryServiceTest.kt @@ -2,7 +2,7 @@ package com.epam.brn.service import com.epam.brn.dto.StudyHistoryDto import com.epam.brn.dto.UserAccountDto -import com.epam.brn.dto.statistic.UserDailyDetailStatisticsDto +import com.epam.brn.dto.statistics.UserDailyDetailStatisticsDto import com.epam.brn.enums.BrnGender import com.epam.brn.model.Exercise import com.epam.brn.model.StudyHistory @@ -235,7 +235,7 @@ internal class StudyHistoryServiceTest { } @Test - fun `getDailyStatistics without user should return statistic for day for user from current session`() { + fun `getDailyStatistics without user should return statistics for day for user from current session`() { // GIVEN val userId = 1L val exerciseDate = LocalDateTime.now() @@ -270,14 +270,14 @@ internal class StudyHistoryServiceTest { // WHEN val statisticsForPeriod = studyHistoryService.getUserDailyStatistics(exerciseDate) - val statistic = statisticsForPeriod.first() + val statistics = statisticsForPeriod.first() // THEN - assertEquals(expectedStatistic, statistic) + assertEquals(expectedStatistic, statistics) } @Test - fun `getDailyStatistics (2 equals exercise) should return statistic for day`() { + fun `getDailyStatistics (2 equals exercise) should return statistics for day`() { // GIVEN val userId = 1L val exerciseDate = LocalDateTime.now() @@ -312,12 +312,12 @@ internal class StudyHistoryServiceTest { // THEN assertEquals(1, statisticsForPeriod.size) - val statistic = statisticsForPeriod.first() - assertEquals(expectedStatistic, statistic) + val statistics = statisticsForPeriod.first() + assertEquals(expectedStatistic, statistics) } @Test - fun `getDailyStatistics (2 different series with one repeated exercise) should return statistic for day`() { + fun `getDailyStatistics (2 different series with one repeated exercise) should return statistics for day`() { // GIVEN val userId = 1L val exerciseDate = LocalDateTime.now() diff --git a/src/test/kotlin/com/epam/brn/service/UserAnalyticsServiceTest.kt b/src/test/kotlin/com/epam/brn/service/UserAnalyticsServiceTest.kt index 175d2f553..7aa8047e3 100644 --- a/src/test/kotlin/com/epam/brn/service/UserAnalyticsServiceTest.kt +++ b/src/test/kotlin/com/epam/brn/service/UserAnalyticsServiceTest.kt @@ -2,7 +2,7 @@ package com.epam.brn.service import com.epam.brn.dto.AudioFileMetaData import com.epam.brn.dto.azure.tts.AzureRates -import com.epam.brn.dto.statistic.DayStudyStatistic +import com.epam.brn.dto.statistics.DayStudyStatistics import com.epam.brn.enums.BrnLocale import com.epam.brn.enums.BrnRole import com.epam.brn.enums.Voice @@ -14,7 +14,7 @@ import com.epam.brn.repo.ExerciseRepository import com.epam.brn.repo.StudyHistoryRepository import com.epam.brn.repo.UserAccountRepository import com.epam.brn.service.impl.UserAnalyticsServiceImpl -import com.epam.brn.service.statistic.UserPeriodStatisticService +import com.epam.brn.service.statistics.UserPeriodStatisticsService import io.kotest.matchers.shouldBe import io.mockk.every import io.mockk.impl.annotations.InjectMockKs @@ -44,7 +44,7 @@ internal class UserAnalyticsServiceTest { lateinit var exerciseRepository: ExerciseRepository @MockK - lateinit var userDayStatisticService: UserPeriodStatisticService + lateinit var userDayStatisticService: UserPeriodStatisticsService @MockK lateinit var timeService: TimeService @@ -65,7 +65,7 @@ internal class UserAnalyticsServiceTest { lateinit var doctorAccount: UserAccount @MockK(relaxed = true) - lateinit var dayStudyStatistic: DayStudyStatistic + lateinit var dayStudyStatistics: DayStudyStatistics @MockK lateinit var userStatisticView: UserStatisticView @@ -74,16 +74,16 @@ internal class UserAnalyticsServiceTest { fun `should return all users with analytics`() { val usersList = listOf(doctorAccount, doctorAccount) - val dayStatisticList = listOf(dayStudyStatistic, dayStudyStatistic) + val dayStatisticList = listOf(dayStudyStatistics, dayStudyStatistics) every { userStatisticView.firstStudy } returns LocalDateTime.now() every { userStatisticView.lastStudy } returns LocalDateTime.now() every { userStatisticView.spentTime } returns 10000L every { userStatisticView.doneExercises } returns 1 every { userAccountRepository.findUsersAccountsByRole(BrnRole.ADMIN) } returns usersList - every { userDayStatisticService.getStatisticForPeriod(any(), any(), any()) } returns dayStatisticList + every { userDayStatisticService.getStatisticsForPeriod(any(), any(), any()) } returns dayStatisticList every { timeService.now() } returns LocalDateTime.now() - every { studyHistoryRepository.getStatisticByUserAccountId(any()) } returns userStatisticView + every { studyHistoryRepository.getStatisticsByUserAccountId(any()) } returns userStatisticView val userAnalyticsDtos = userAnalyticsService.getUsersWithAnalytics(pageable, BrnRole.ADMIN) @@ -94,16 +94,16 @@ internal class UserAnalyticsServiceTest { fun `should not return user with analytics`() { val usersList = listOf(doctorAccount) - val dayStatisticList = emptyList() + val dayStatisticList = emptyList() every { userStatisticView.firstStudy } returns LocalDateTime.now() every { userStatisticView.lastStudy } returns LocalDateTime.now() every { userStatisticView.spentTime } returns 10000L every { userStatisticView.doneExercises } returns 1 every { userAccountRepository.findUsersAccountsByRole(BrnRole.ADMIN) } returns usersList - every { userDayStatisticService.getStatisticForPeriod(any(), any(), any()) } returns dayStatisticList + every { userDayStatisticService.getStatisticsForPeriod(any(), any(), any()) } returns dayStatisticList every { timeService.now() } returns LocalDateTime.now() - every { studyHistoryRepository.getStatisticByUserAccountId(any()) } returns userStatisticView + every { studyHistoryRepository.getStatisticsByUserAccountId(any()) } returns userStatisticView val userAnalyticsDtos = userAnalyticsService.getUsersWithAnalytics(pageable, BrnRole.ADMIN) @@ -201,7 +201,7 @@ internal class UserAnalyticsServiceTest { } @Test - fun `should prepareAudioFileMetaData default speed correctly for one word and good statistic`() { + fun `should prepareAudioFileMetaData default speed correctly for one word and good statistics`() { // GIVEN val studyHistory = mockk() every { userAccountService.getCurrentUserId() } returns currentUserId @@ -222,7 +222,7 @@ internal class UserAnalyticsServiceTest { } @Test - fun `should prepareAudioFileMetaData slow correctly for single word and bad statistic`() { + fun `should prepareAudioFileMetaData slow correctly for single word and bad statistics`() { // GIVEN val studyHistory = mockk() every { userAccountService.getCurrentUserId() } returns currentUserId diff --git a/src/test/kotlin/com/epam/brn/service/impl/UserStatisticServiceImplTest.kt b/src/test/kotlin/com/epam/brn/service/impl/UserStatisticsServiceImplTest.kt similarity index 95% rename from src/test/kotlin/com/epam/brn/service/impl/UserStatisticServiceImplTest.kt rename to src/test/kotlin/com/epam/brn/service/impl/UserStatisticsServiceImplTest.kt index 58eddadf8..f98d809de 100644 --- a/src/test/kotlin/com/epam/brn/service/impl/UserStatisticServiceImplTest.kt +++ b/src/test/kotlin/com/epam/brn/service/impl/UserStatisticsServiceImplTest.kt @@ -6,7 +6,7 @@ import com.epam.brn.repo.ExerciseRepository import com.epam.brn.repo.StudyHistoryRepository import com.epam.brn.repo.SubGroupRepository import com.epam.brn.service.UserAccountService -import com.epam.brn.service.statistic.impl.UserStatisticServiceImpl +import com.epam.brn.service.statistics.impl.UserStatisticServiceImpl import io.mockk.every import io.mockk.impl.annotations.InjectMockKs import io.mockk.impl.annotations.MockK @@ -22,7 +22,7 @@ import kotlin.test.assertNotNull * @author Nikolai Lazarev */ @ExtendWith(MockKExtension::class) -internal class UserStatisticServiceImplTest { +internal class UserStatisticsServiceImplTest { @InjectMockKs lateinit var userStatisticService: UserStatisticServiceImpl diff --git a/src/test/kotlin/com/epam/brn/service/statistic/progress/UserDayStatisticServiceTest.kt b/src/test/kotlin/com/epam/brn/service/statistics/progress/UserDayStatisticsServiceTest.kt similarity index 77% rename from src/test/kotlin/com/epam/brn/service/statistic/progress/UserDayStatisticServiceTest.kt rename to src/test/kotlin/com/epam/brn/service/statistics/progress/UserDayStatisticsServiceTest.kt index 3d894d4d5..7ed245987 100644 --- a/src/test/kotlin/com/epam/brn/service/statistic/progress/UserDayStatisticServiceTest.kt +++ b/src/test/kotlin/com/epam/brn/service/statistics/progress/UserDayStatisticsServiceTest.kt @@ -1,14 +1,14 @@ -package com.epam.brn.service.statistic.progress +package com.epam.brn.service.statistics.progress import com.epam.brn.dto.UserAccountDto -import com.epam.brn.dto.statistic.DayStudyStatistic -import com.epam.brn.dto.statistic.UserExercisingPeriod -import com.epam.brn.dto.statistic.UserExercisingProgressStatus +import com.epam.brn.dto.statistics.DayStudyStatistics +import com.epam.brn.dto.statistics.UserExercisingPeriod +import com.epam.brn.dto.statistics.UserExercisingProgressStatus import com.epam.brn.model.StudyHistory import com.epam.brn.repo.StudyHistoryRepository import com.epam.brn.service.UserAccountService -import com.epam.brn.service.statistic.impl.UserDayStatisticService -import com.epam.brn.service.statistic.progress.status.ProgressStatusManager +import com.epam.brn.service.statistics.impl.UserDayStatisticsService +import com.epam.brn.service.statistics.progress.status.ProgressStatusManager import io.mockk.every import io.mockk.impl.annotations.InjectMockKs import io.mockk.impl.annotations.MockK @@ -21,10 +21,10 @@ import kotlin.test.assertEquals import kotlin.test.assertTrue @ExtendWith(MockKExtension::class) -internal class UserDayStatisticServiceTest { +internal class UserDayStatisticsServiceTest { @InjectMockKs - private lateinit var userDayStatisticService: UserDayStatisticService + private lateinit var userDayStatisticsService: UserDayStatisticsService @MockK private lateinit var studyHistoryRepository: StudyHistoryRepository @@ -60,7 +60,7 @@ internal class UserDayStatisticServiceTest { } @Test - fun `getStatisticForPeriod should return statistic for a day`() { + fun `getStatisticsForPeriod should return statistics for a day`() { // GIVEN val studyHistories = listOf(studyHistory) every { studyHistory.startTime } returns studyHistoryDate @@ -74,14 +74,14 @@ internal class UserDayStatisticServiceTest { every { studyHistoryRepository.getHistories(userAccountId, from, to) } returns studyHistories - val expectedStatistic = DayStudyStatistic( + val expectedStatistic = DayStudyStatistics( date = studyHistoryDate, exercisingTimeSeconds = exercisingSeconds, progress = userProgress ) // WHEN - val statisticForPeriod = userDayStatisticService.getStatisticForPeriod(from, to) + val statisticForPeriod = userDayStatisticsService.getStatisticsForPeriod(from, to) // THEN assertEquals(expectedStatistic, statisticForPeriod.first()) @@ -95,7 +95,7 @@ internal class UserDayStatisticServiceTest { } returns emptyList() // WHEN - val statisticForPeriod = userDayStatisticService.getStatisticForPeriod(from, to) + val statisticForPeriod = userDayStatisticsService.getStatisticsForPeriod(from, to) // THEN assertTrue(statisticForPeriod.isEmpty()) diff --git a/src/test/kotlin/com/epam/brn/service/statistic/progress/UserMonthStatisticServiceTest.kt b/src/test/kotlin/com/epam/brn/service/statistics/progress/UserMonthStatisticsServiceTest.kt similarity index 79% rename from src/test/kotlin/com/epam/brn/service/statistic/progress/UserMonthStatisticServiceTest.kt rename to src/test/kotlin/com/epam/brn/service/statistics/progress/UserMonthStatisticsServiceTest.kt index a6897150e..026eaed85 100644 --- a/src/test/kotlin/com/epam/brn/service/statistic/progress/UserMonthStatisticServiceTest.kt +++ b/src/test/kotlin/com/epam/brn/service/statistics/progress/UserMonthStatisticsServiceTest.kt @@ -1,14 +1,14 @@ -package com.epam.brn.service.statistic.progress +package com.epam.brn.service.statistics.progress import com.epam.brn.dto.UserAccountDto -import com.epam.brn.dto.statistic.MonthStudyStatistic -import com.epam.brn.dto.statistic.UserExercisingPeriod -import com.epam.brn.dto.statistic.UserExercisingProgressStatus +import com.epam.brn.dto.statistics.MonthStudyStatistics +import com.epam.brn.dto.statistics.UserExercisingPeriod +import com.epam.brn.dto.statistics.UserExercisingProgressStatus import com.epam.brn.model.StudyHistory import com.epam.brn.repo.StudyHistoryRepository import com.epam.brn.service.UserAccountService -import com.epam.brn.service.statistic.impl.UserMonthStatisticService -import com.epam.brn.service.statistic.progress.status.ProgressStatusManager +import com.epam.brn.service.statistics.impl.UserMonthStatisticsService +import com.epam.brn.service.statistics.progress.status.ProgressStatusManager import io.mockk.every import io.mockk.impl.annotations.InjectMockKs import io.mockk.impl.annotations.MockK @@ -21,10 +21,10 @@ import kotlin.test.assertEquals import kotlin.test.assertTrue @ExtendWith(MockKExtension::class) -internal class UserMonthStatisticServiceTest { +internal class UserMonthStatisticsServiceTest { @InjectMockKs - private lateinit var userMonthStatisticService: UserMonthStatisticService + private lateinit var userMonthStatisticsService: UserMonthStatisticsService @MockK private lateinit var userAccountService: UserAccountService @@ -69,7 +69,7 @@ internal class UserMonthStatisticServiceTest { } @Test - fun `getStatisticForPeriod should return statistic for period from to`() { + fun `getStatisticForPeriod should return statistics for period from to`() { // GIVEN every { studyHistorySecond.startTime } returns studyHistoryDate every { studyHistorySecond.executionSeconds } returns executionSeconds @@ -84,7 +84,7 @@ internal class UserMonthStatisticServiceTest { ) } returns progress - val expectedStatistic = MonthStudyStatistic( + val expectedStatistic = MonthStudyStatistics( date = studyHistory.startTime, exercisingTimeSeconds = executionSeconds * 2, exercisingDays = 1, @@ -92,15 +92,15 @@ internal class UserMonthStatisticServiceTest { ) // WHEN - val statisticsForPeriod = userMonthStatisticService.getStatisticForPeriod(from, to) - val statistic = statisticsForPeriod.first() + val statisticsForPeriod = userMonthStatisticsService.getStatisticsForPeriod(from, to) + val statistics = statisticsForPeriod.first() // THEN - assertEquals(expectedStatistic, statistic) + assertEquals(expectedStatistic, statistics) } @Test - fun `getStatisticForPeriod should return statistic for period when there are histories for some month`() { + fun `getStatisticsForPeriod should return statistics for period when there are histories for some month`() { val studyHistories = listOf( studyHistory, studyHistorySecond @@ -123,13 +123,13 @@ internal class UserMonthStatisticServiceTest { studyHistoryRepository.getHistories(userId, from, to) } returns studyHistories - val firstExpectedStudyStatistic = MonthStudyStatistic( + val firstExpectedStudyStatistic = MonthStudyStatistics( date = studyHistoryDate, exercisingTimeSeconds = executionSeconds, exercisingDays = 1, progress = progress ) - val secondExpectedStudyStatistic = MonthStudyStatistic( + val secondExpectedStudyStatistic = MonthStudyStatistics( date = studyHistoryDate, exercisingTimeSeconds = executionSeconds, exercisingDays = 1, @@ -137,7 +137,7 @@ internal class UserMonthStatisticServiceTest { ) // WHEN - val statisticForPeriod = userMonthStatisticService.getStatisticForPeriod(from, to) + val statisticForPeriod = userMonthStatisticsService.getStatisticsForPeriod(from, to) // THEN assertEquals(2, statisticForPeriod.size) @@ -157,7 +157,7 @@ internal class UserMonthStatisticServiceTest { every { studyHistoryRepository.getHistories(userId, from, to) } returns emptyList() // WHEN - val statisticForPeriod = userMonthStatisticService.getStatisticForPeriod(from, to) + val statisticForPeriod = userMonthStatisticsService.getStatisticsForPeriod(from, to) // THEN assertTrue(statisticForPeriod.isEmpty()) diff --git a/src/test/kotlin/com/epam/brn/service/statistic/progress/status/impl/StudyHistoriesProgressStatusManagerTest.kt b/src/test/kotlin/com/epam/brn/service/statistics/progress/status/impl/StudyHistoriesProgressStatusManagerTest.kt similarity index 91% rename from src/test/kotlin/com/epam/brn/service/statistic/progress/status/impl/StudyHistoriesProgressStatusManagerTest.kt rename to src/test/kotlin/com/epam/brn/service/statistics/progress/status/impl/StudyHistoriesProgressStatusManagerTest.kt index 83cde2d68..f0054317f 100644 --- a/src/test/kotlin/com/epam/brn/service/statistic/progress/status/impl/StudyHistoriesProgressStatusManagerTest.kt +++ b/src/test/kotlin/com/epam/brn/service/statistics/progress/status/impl/StudyHistoriesProgressStatusManagerTest.kt @@ -1,9 +1,9 @@ -package com.epam.brn.service.statistic.progress.status.impl +package com.epam.brn.service.statistics.progress.status.impl -import com.epam.brn.dto.statistic.UserExercisingPeriod -import com.epam.brn.dto.statistic.UserExercisingProgressStatus +import com.epam.brn.dto.statistics.UserExercisingPeriod +import com.epam.brn.dto.statistics.UserExercisingProgressStatus import com.epam.brn.model.StudyHistory -import com.epam.brn.service.statistic.progress.status.ExercisingStatusRetriever +import com.epam.brn.service.statistics.progress.status.ExercisingStatusRetriever import io.mockk.every import io.mockk.impl.annotations.InjectMockKs import io.mockk.impl.annotations.MockK diff --git a/src/test/kotlin/com/epam/brn/service/statistic/progress/status/impl/UserRestTimeRetrieverImplTest.kt b/src/test/kotlin/com/epam/brn/service/statistics/progress/status/impl/UserRestTimeRetrieverImplTest.kt similarity index 98% rename from src/test/kotlin/com/epam/brn/service/statistic/progress/status/impl/UserRestTimeRetrieverImplTest.kt rename to src/test/kotlin/com/epam/brn/service/statistics/progress/status/impl/UserRestTimeRetrieverImplTest.kt index daec36536..618454de8 100644 --- a/src/test/kotlin/com/epam/brn/service/statistic/progress/status/impl/UserRestTimeRetrieverImplTest.kt +++ b/src/test/kotlin/com/epam/brn/service/statistics/progress/status/impl/UserRestTimeRetrieverImplTest.kt @@ -1,4 +1,4 @@ -package com.epam.brn.service.statistic.progress.status.impl +package com.epam.brn.service.statistics.progress.status.impl import com.epam.brn.dto.UserAccountDto import com.epam.brn.model.StudyHistory diff --git a/src/test/kotlin/com/epam/brn/service/statistic/progress/status/impl/retriever/DayExercisingStatusRetrieverTest.kt b/src/test/kotlin/com/epam/brn/service/statistics/progress/status/impl/retriever/DayExercisingStatusRetrieverTest.kt similarity index 90% rename from src/test/kotlin/com/epam/brn/service/statistic/progress/status/impl/retriever/DayExercisingStatusRetrieverTest.kt rename to src/test/kotlin/com/epam/brn/service/statistics/progress/status/impl/retriever/DayExercisingStatusRetrieverTest.kt index 1f70675a4..5b911d1c8 100644 --- a/src/test/kotlin/com/epam/brn/service/statistic/progress/status/impl/retriever/DayExercisingStatusRetrieverTest.kt +++ b/src/test/kotlin/com/epam/brn/service/statistics/progress/status/impl/retriever/DayExercisingStatusRetrieverTest.kt @@ -1,10 +1,10 @@ -package com.epam.brn.service.statistic.progress.status.impl.retriever +package com.epam.brn.service.statistics.progress.status.impl.retriever -import com.epam.brn.dto.statistic.StatusRequirements -import com.epam.brn.dto.statistic.UserExercisingPeriod -import com.epam.brn.dto.statistic.UserExercisingProgressStatus +import com.epam.brn.dto.statistics.StatusRequirements +import com.epam.brn.dto.statistics.UserExercisingPeriod +import com.epam.brn.dto.statistics.UserExercisingProgressStatus import com.epam.brn.model.StudyHistory -import com.epam.brn.service.statistic.progress.status.requirements.StatusRequirementsManager +import com.epam.brn.service.statistics.progress.status.requirements.StatusRequirementsManager import io.mockk.every import io.mockk.impl.annotations.InjectMockKs import io.mockk.impl.annotations.MockK diff --git a/src/test/kotlin/com/epam/brn/service/statistic/progress/status/impl/retriever/WeekExercisingStatusRetrieverTest.kt b/src/test/kotlin/com/epam/brn/service/statistics/progress/status/impl/retriever/WeekExercisingStatusRetrieverTest.kt similarity index 91% rename from src/test/kotlin/com/epam/brn/service/statistic/progress/status/impl/retriever/WeekExercisingStatusRetrieverTest.kt rename to src/test/kotlin/com/epam/brn/service/statistics/progress/status/impl/retriever/WeekExercisingStatusRetrieverTest.kt index e2d60472c..9122cbc52 100644 --- a/src/test/kotlin/com/epam/brn/service/statistic/progress/status/impl/retriever/WeekExercisingStatusRetrieverTest.kt +++ b/src/test/kotlin/com/epam/brn/service/statistics/progress/status/impl/retriever/WeekExercisingStatusRetrieverTest.kt @@ -1,12 +1,12 @@ -package com.epam.brn.service.statistic.progress.status.impl.retriever +package com.epam.brn.service.statistics.progress.status.impl.retriever -import com.epam.brn.dto.statistic.StatusRequirements -import com.epam.brn.dto.statistic.UserExercisingPeriod -import com.epam.brn.dto.statistic.UserExercisingProgressStatus +import com.epam.brn.dto.statistics.StatusRequirements +import com.epam.brn.dto.statistics.UserExercisingPeriod +import com.epam.brn.dto.statistics.UserExercisingProgressStatus import com.epam.brn.model.StudyHistory import com.epam.brn.model.UserAccount -import com.epam.brn.service.statistic.progress.status.UserRestTimeRetriever -import com.epam.brn.service.statistic.progress.status.requirements.StatusRequirementsManager +import com.epam.brn.service.statistics.progress.status.UserRestTimeRetriever +import com.epam.brn.service.statistics.progress.status.requirements.StatusRequirementsManager import io.mockk.every import io.mockk.impl.annotations.InjectMockKs import io.mockk.impl.annotations.MockK diff --git a/src/test/kotlin/com/epam/brn/service/statistic/progress/status/requirements/impl/ApplicationPropertiesRequirementsRetrieverTest.kt b/src/test/kotlin/com/epam/brn/service/statistics/progress/status/requirements/impl/ApplicationPropertiesRequirementsRetrieverTest.kt similarity index 89% rename from src/test/kotlin/com/epam/brn/service/statistic/progress/status/requirements/impl/ApplicationPropertiesRequirementsRetrieverTest.kt rename to src/test/kotlin/com/epam/brn/service/statistics/progress/status/requirements/impl/ApplicationPropertiesRequirementsRetrieverTest.kt index 283bb725a..febbc2649 100644 --- a/src/test/kotlin/com/epam/brn/service/statistic/progress/status/requirements/impl/ApplicationPropertiesRequirementsRetrieverTest.kt +++ b/src/test/kotlin/com/epam/brn/service/statistics/progress/status/requirements/impl/ApplicationPropertiesRequirementsRetrieverTest.kt @@ -1,8 +1,8 @@ -package com.epam.brn.service.statistic.progress.status.requirements.impl +package com.epam.brn.service.statistics.progress.status.requirements.impl -import com.epam.brn.dto.statistic.StatusRequirements -import com.epam.brn.dto.statistic.UserExercisingPeriod -import com.epam.brn.dto.statistic.UserExercisingProgressStatus +import com.epam.brn.dto.statistics.StatusRequirements +import com.epam.brn.dto.statistics.UserExercisingPeriod +import com.epam.brn.dto.statistics.UserExercisingProgressStatus import io.mockk.every import io.mockk.impl.annotations.InjectMockKs import io.mockk.impl.annotations.MockK @@ -26,7 +26,7 @@ internal class ApplicationPropertiesRequirementsRetrieverTest { @MockK private lateinit var env: Environment - private val basePath = "brn.statistic.progress" + private val basePath = "brn.statistics.progress" @Test fun `getRequirementsForStatus should return requirements for BAD status`() { diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index 56c573646..e826d5eed 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -67,19 +67,19 @@ brn.resources.pictures.ext=png brn.resources.pictures.update-job.cron = 0 0 0 1 * * brn.dataFormatNumLines=5 -brn.statistic.progress.day.status.bad.minimal=0 -brn.statistic.progress.day.status.bad.maximal=15 -brn.statistic.progress.day.status.good.minimal=15 -brn.statistic.progress.day.status.good.maximal=20 -brn.statistic.progress.day.status.great.minimal=20 -brn.statistic.progress.day.status.great.maximal=1440 - -brn.statistic.progress.week.status.bad.minimal=0 -brn.statistic.progress.week.status.bad.maximal=5 -brn.statistic.progress.week.status.good.minimal=5 -brn.statistic.progress.week.status.good.maximal=6 -brn.statistic.progress.week.status.great.minimal=6 -brn.statistic.progress.week.status.great.maximal=8 +brn.statistics.progress.day.status.bad.minimal=0 +brn.statistics.progress.day.status.bad.maximal=15 +brn.statistics.progress.day.status.good.minimal=15 +brn.statistics.progress.day.status.good.maximal=20 +brn.statistics.progress.day.status.great.minimal=20 +brn.statistics.progress.day.status.great.maximal=1440 + +brn.statistics.progress.week.status.bad.minimal=0 +brn.statistics.progress.week.status.bad.maximal=5 +brn.statistics.progress.week.status.good.minimal=5 +brn.statistics.progress.week.status.good.maximal=6 +brn.statistics.progress.week.status.great.minimal=6 +brn.statistics.progress.week.status.great.maximal=8 audioRusPathFilipp=oggRus/filipp/%s.ogg audioRusPathAlena=oggRus/alena/%s.ogg