From b9ea0b752d8994a79cbc848cb11833ae52e62dc9 Mon Sep 17 00:00:00 2001 From: ChaHyeonMin Date: Mon, 6 May 2024 18:16:01 +0900 Subject: [PATCH] =?UTF-8?q?fix=20:=20=EB=A0=88=EB=94=94=EC=8A=A4=20?= =?UTF-8?q?=ED=8B=B0=EC=BC=93=20=EC=A0=95=EB=B3=B4=EB=A1=9C=20DB=20?= =?UTF-8?q?=EB=8D=A4=ED=94=84=20=EC=8B=9C=20=EC=A4=91=EB=B3=B5=20=ED=8B=B0?= =?UTF-8?q?=EC=BC=93=EC=9D=B4=20=EC=83=9D=EA=B8=B0=EB=8A=94=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/dku/council/domain/batch/TicketScheduler.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/dku/council/domain/batch/TicketScheduler.java b/src/main/java/com/dku/council/domain/batch/TicketScheduler.java index 8b8bde0b..c7ed3d4f 100644 --- a/src/main/java/com/dku/council/domain/batch/TicketScheduler.java +++ b/src/main/java/com/dku/council/domain/batch/TicketScheduler.java @@ -29,8 +29,10 @@ public void dumpToDb() { for (TicketDto dto : tickets) { User user = userRepository.getReferenceById(dto.getUserId()); TicketEvent event = ticketEventRepository.getReferenceById(dto.getEventId()); - Ticket ticket = new Ticket(user, event, dto.getTurn()); - persistenceRepository.save(ticket); + if(persistenceRepository.findByUserIdAndEventId(user.getId(), event.getId()).isEmpty()) { + Ticket ticket = new Ticket(user, event, dto.getTurn()); + persistenceRepository.save(ticket); + } } } }