Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change structure acheievements #6419

Merged
merged 54 commits into from
Oct 4, 2023
Merged

Conversation

ospodaryk
Copy link
Contributor

@ospodaryk ospodaryk commented Sep 26, 2023

GreenCity PR

Update Achievement structure #6421

Summary Of Changes 🔥

Added new enum of achievements
Updated old implementation of achievement service

Added

New enum of achievements

Changed

Implementation of achievement service

Deleted

Unused methods and fields

PR Checklist Forms

(to be filled out by PR submitter)

  • Code is up-to-date with the dev branch.
  • You've successfully built and run the tests locally.
  • There are new or updated unit tests validating the change.
  • JIRA/ Github Issue number & title in PR title (ISSUE-XXXX: Ticket title)
  • This template filled (above this section).
  • Sonar's report does not contain bugs, vulnerabilities, security issues, code smells ar duplication
  • NEED_REVIEW and READY_FOR_REVIEW labels are added.
  • All files reviewed before sending to reviewers

@@ -9,7 +9,7 @@
import greencity.dto.PageableAdvancedDto;
import greencity.dto.achievement.AchievementManagementDto;
import greencity.dto.achievement.AchievementPostDto;
import greencity.dto.achievement.AchievementTranslationVO;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove this blank line

@@ -162,11 +162,10 @@
import greencity.entity.event.EventComment;
import greencity.entity.event.EventDateLocation;
import greencity.entity.event.EventGrade;
import greencity.entity.localization.AchievementTranslation;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@@ -454,7 +452,7 @@ public static UserVO getUserVOWithData() {
.build(),
UserAchievementVO.builder()
.id(39L)
.achievementStatus(AchievementStatus.INACTIVE)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@@ -1379,48 +1377,44 @@ public static AdvicePostDto getAdvicePostDto() {
}

public static Achievement getAchievement() {
return new Achievement(1L, Collections.singletonList(getAchievementTranslation()), Collections.emptyList(),
return new Achievement(1L,
"CREATED_5_NEWS", "CREATED_5_NEWS", "CREATED_5_NEWS",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is not a good practice to use the same value for the different variables

}

public static AchievementPostDto getAchievementPostDto() {
return new AchievementPostDto(Collections.emptyList(), getAchievementCategoryDto(), 1);
return new AchievementPostDto("CREATED_5_NEWS", "CREATED_5_NEWS", "CREATED_5_NEWS", getAchievementCategoryDto(),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

}

public static AchievementVO getAchievementVO() {
return new AchievementVO(1L, Collections.emptyList(), Collections.emptyList(), new AchievementCategoryVO(), 1);
return new AchievementVO(1L, "CREATED_5_NEWS", "CREATED_5_NEWS", "CREATED_5_NEWS", new AchievementCategoryVO(),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@@ -1698,7 +1692,7 @@ public static UserVO createUserVO2() {
.userAchievements(List.of(
UserAchievementVO.builder()
.id(47L)
.achievementStatus(AchievementStatus.ACTIVE)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove blank line

@@ -1708,7 +1702,7 @@ public static UserVO createUserVO2() {
.build(),
UserAchievementVO.builder()
.id(39L)
.achievementStatus(AchievementStatus.INACTIVE)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@@ -1776,7 +1770,7 @@ public static UserVO createUserVO2() {
.userAchievements(List.of(
UserAchievementVO.builder()
.id(47L)
.achievementStatus(AchievementStatus.ACTIVE)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@@ -1786,7 +1780,7 @@ public static UserVO createUserVO2() {
.build(),
UserAchievementVO.builder()
.id(39L)
.achievementStatus(AchievementStatus.INACTIVE)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

import greencity.entity.Language;
import greencity.entity.UserAchievement;
import greencity.entity.localization.AchievementTranslation;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove blank line

import greencity.enums.AchievementCategoryType;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

when(modelMapper.map(ecoNews, AddEcoNewsDtoResponse.class)).thenReturn(addEcoNewsDtoResponse);
when(modelMapper.map(ModelUtils.getUserVO(), User.class)).thenReturn(ModelUtils.getUser());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add verify

@@ -178,7 +184,7 @@ void saveEcoNews() {
when(modelMapper.map(tagVOList,
new TypeToken<List<Tag>>() {
}.getType())).thenReturn(tags);

when(userService.findByEmail(anyString())).thenReturn(ModelUtils.getUserVO());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 3, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

warning The version of Java (11.0.20) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Read more here

@ospodaryk ospodaryk merged commit 5146cec into dev Oct 4, 2023
3 checks passed
@ospodaryk ospodaryk deleted the change-structure-acheievements branch October 4, 2023 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants