Skip to content

Commit

Permalink
refactor : 테이스팅 노트 sparkling 필드 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
imenuuu committed Oct 4, 2024
1 parent 025f176 commit 3809d9a
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public TastingNoteResponse.TasteAnalysisDTO TasteAnalysis(List<TastingNote> tast
int alcoholSum = 0;
int bodySum = 0;
int tanninSum = 0;
int sparklingSum = 0;
int finishSum = 0;
int totalPrice = 0;

Expand Down Expand Up @@ -88,6 +89,7 @@ public TastingNoteResponse.TasteAnalysisDTO TasteAnalysis(List<TastingNote> tast
alcoholSum += tastingNote.getAlcohol();
bodySum += tastingNote.getBody();
tanninSum += tastingNote.getTannins();
sparklingSum += tastingNote.getSparkling() != null ? tastingNote.getSparkling() : 0;
finishSum += tastingNote.getFinish();
totalPrice += tastingNote.getPrice() != null ? tastingNote.getPrice() : 0;

Expand Down Expand Up @@ -189,6 +191,7 @@ public int compare(Map.Entry<String, Integer> entry1, Map.Entry<String, Integer>
.alcohol(calculateAvg(alcoholSum, totalWineCnt))
.body(calculateAvg(bodySum, totalWineCnt))
.tannin(calculateAvg(tanninSum, totalWineCnt))
.sparkling(calculateAvg(sparklingSum, totalWineCnt))
.finish(calculateAvg(finishSum, totalWineCnt))
.build())
.build();
Expand Down Expand Up @@ -238,6 +241,7 @@ public TastingNote CreateTastingNote(TastingNoteRequest.CreateTastingNoteDTO req
.vintage(request.getVintage())
.tannins(request.getTannin())
.finish(request.getFinish())
.sparkling(request.getSparkling())
.price(request.getPrice() != null ? request.getPrice() : 0)
.memo(request.getMemo())
.buyAgain(request.getBuyAgain())
Expand Down Expand Up @@ -353,6 +357,7 @@ private TastingNoteResponse.MyWineTaste MyWineTaste(TastingNote tastingNote) {
.alcohol(tastingNote.getAlcohol())
.body(tastingNote.getBody())
.tannin(tastingNote.getTannins())
.sparkling(tastingNote.getSparkling() != null ? Double.valueOf(tastingNote.getSparkling()) : 0)
.finish(tastingNote.getFinish())
.build();
}
Expand Down Expand Up @@ -424,6 +429,10 @@ public void updateTastingNote(TastingNote tastingNote, TastingNoteRequest.Update
tastingNote.setAlcohol(request.getAlcohol());
tastingNote.setTannins(request.getTannin());
tastingNote.setFinish(request.getFinish());
if (request.getSparkling() != null){
tastingNote.setSparkling(request.getSparkling());
}
tastingNote.setSparkling(request.getSparkling());
tastingNote.setColor(request.getColor());
tastingNote.setVintage(request.getVintage());
Boolean isPublic = request.getIsPublic();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ public static class CreateTastingNoteDTO {
@Schema(name="finish",description = "여운", required = true)
private Integer finish;

@Schema(name = "sparkling", description = "탄산감", required = false)
private Integer sparkling;

@NotNull(message = "느낌을 입력해주세요")
@Schema(name ="memo",description = "느낌", required = true)
private String memo;
Expand Down Expand Up @@ -142,6 +145,9 @@ public static class UpdateTastingNoteDTO {
@Schema(name="tannin",description = "탄닌", required = true)
private Integer tannin;

@Schema(name = "sparkling", description = "탄산감", required = false)
private Integer sparkling;

@Min(value = 1 ,message = "1이상을 입력해주세요")
@Max(value = 5 ,message = "5이하를 입력해주세요")
@Schema(name="finish",description = "여운", required = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ public static class MyWineTaste{

private double tannin;

private Double sparkling;

private double finish;
}

Expand Down Expand Up @@ -227,6 +229,8 @@ public static class Taste{

private double tannin;

private Double sparkling;

private double finish;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public class QTastingNote extends EntityPathBase<TastingNote> {

public final ListPath<SmellKeywordTastingNote, QSmellKeywordTastingNote> smellKeywordTastingNote = this.<SmellKeywordTastingNote, QSmellKeywordTastingNote>createList("smellKeywordTastingNote", SmellKeywordTastingNote.class, QSmellKeywordTastingNote.class, PathInits.DIRECT2);

public final NumberPath<Integer> sparkling = createNumber("sparkling", Integer.class);

public final NumberPath<Integer> starRating = createNumber("starRating", Integer.class);

public final NumberPath<Integer> sweetness = createNumber("sweetness", Integer.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ public class TastingNote extends BaseEntity {
@Column(name = "tannins")
private Integer tannins;

@Column(name ="sparkling")
private Integer sparkling;

/**
* 여운
*/
Expand Down

0 comments on commit 3809d9a

Please sign in to comment.