Skip to content

Commit

Permalink
Merge pull request #42 from lsn5963/feat/quest
Browse files Browse the repository at this point in the history
잘못된 로그 수정 및 퀘스트 완료 로직 수정
  • Loading branch information
lsn5963 authored Aug 17, 2024
2 parents 5f68db4 + 3d25bbf commit c485197
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
1 change: 0 additions & 1 deletion src/main/java/com/noplanb/NoPlanBApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public static void main(String[] args) {
}
@PostConstruct
public void init() {
System.out.println("true = " + true);
// timezone 설정
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Seoul"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public ResponseEntity<?> createQuest(CreateQuestReq createQuestReq, UserPrincipa
return createApiResponse((Message.builder().message("퀘스트를 만들었습니다.").build()));
}
public ResponseEntity<?> retrieveQuest(LocalDate localDate, UserPrincipal userPrincipal) {
System.out.println("userPrincipal = " + userPrincipal.getId());
Character character = characterRepository.findByUserId(userPrincipal.getId()).orElseThrow(CharacterNotFoundException::new);
List<Quest> quests = character.getQuests();
// 특정 날짜에 해당하는 퀘스트 필터링 후 미완료 완료 로 정렬 후 생성순으로 정렬
Expand Down Expand Up @@ -114,7 +113,7 @@ public ResponseEntity<?> completeQuest(UserPrincipal userPrincipal, Long id) {
String questType = "완료";

// 레벨업 확인
if (character.getTotalExp()>((characterLevel*(characterLevel+1)/2)*10)){
if (character.getTotalExp()>=(((characterLevel*(characterLevel+1))/2)*10)){
questType = "레벨업";
// 레벨업
character.updateLevel();
Expand Down Expand Up @@ -151,7 +150,6 @@ private List<Item> unLockItem(Long level, Character character) {
@Transactional
public ResponseEntity<?> modifyQuest(UserPrincipal userPrincipal, ModifyQuestReq modifyQuestReq) {
Character character = characterRepository.findByUserId(userPrincipal.getId()).orElseThrow(CharacterNotFoundException::new);
System.out.println("character.getCharacterName() = " + character.getCharacterName());
List<Quest> quests = character.getQuests();
// 퀘스트 가져오기
Quest quest = quests.stream().filter(q -> q.getId().equals(modifyQuestReq.getId()))
Expand Down

0 comments on commit c485197

Please sign in to comment.