Skip to content

Commit

Permalink
Merge pull request #131 from Gachon-Table/develop
Browse files Browse the repository at this point in the history
v1.0.6
  • Loading branch information
jwnnoh authored Oct 31, 2024
2 parents 352c003 + 98bffb9 commit 9746b61
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public String execute(AuthDetails authDetails, CallUserRequest request, String l

private void scheduleAutoCancel(UUID waitingId, HashMap<String, String> variables) {
executorService.schedule(() ->
autoCancelUser.execute(waitingId, variables, "자동 취소"), 5, TimeUnit.MINUTES);
autoCancelUser.execute(waitingId, variables, "자동 취소"), 7, TimeUnit.MINUTES);
}

private void checkPubMatches(AuthDetails authDetails, Pub pub) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private void createSeating(Pub pub, Waiting waiting, Integer seatingNum) {
Seating seating = Seating.create(
seatingNum,
waiting.getTableType(),
LocalDateTime.now().plusHours(pub.getHours()),
LocalDateTime.now().plusMinutes(pub.getMinutes()),
pub,
waiting,
waiting.getUser());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Pub {
private static final Integer MAX_WAITING_COUNT = 30;
private static final Integer MAX_WAITING_COUNT = 50;

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Expand All @@ -26,7 +26,7 @@ public class Pub {
private String instagramUrl;

@Column(nullable = false)
private Integer hours;
private Integer minutes;

@Column(nullable = false)
private String menuUrl;
Expand All @@ -40,10 +40,13 @@ public class Pub {
@Column(nullable = false)
private Integer waitingCount;

@Column(nullable = false)
private Boolean autoDisabled;

public static Pub create(String pubName,
String oneLiner,
String instagramUrl,
Integer hours,
Integer minutes,
String menuUrl,
Boolean openStatus,
Boolean waitingStatus,
Expand All @@ -52,7 +55,7 @@ public static Pub create(String pubName,
.pubName(pubName)
.oneLiner(oneLiner)
.instagramUrl(instagramUrl)
.hours(hours)
.minutes(minutes)
.menuUrl(menuUrl)
.openStatus(openStatus)
.waitingStatus(waitingStatus)
Expand All @@ -64,15 +67,15 @@ public static Pub create(String pubName,
private Pub(String pubName,
String oneLiner,
String instagramUrl,
Integer hours,
Integer minutes,
String menuUrl,
Boolean openStatus,
Boolean waitingStatus,
Integer waitingCount) {
this.pubName = pubName;
this.oneLiner = oneLiner;
this.instagramUrl = instagramUrl;
this.hours = hours;
this.minutes = minutes;
this.menuUrl = menuUrl;
this.openStatus = openStatus;
this.waitingStatus = waitingStatus;
Expand All @@ -87,15 +90,20 @@ public void increaseWaitingCount() {
private void checkMaxWaitingCount() {
if (this.waitingCount >= MAX_WAITING_COUNT) {
this.waitingStatus = false;
return;
this.autoDisabled = true;
}
this.waitingStatus = true;
}

public void decreaseWaitingCount() {
validateWaitingCount();
validateCanUpdateWaitingStatusToTrue();
this.waitingCount -= 1;
checkMaxWaitingCount();
}

private void validateCanUpdateWaitingStatusToTrue() {
if (this.autoDisabled && !this.waitingStatus && this.waitingCount <= MAX_WAITING_COUNT) {
this.waitingStatus = true;
}
}

private void validateWaitingCount() {
Expand All @@ -112,6 +120,7 @@ public void updateOpenStatus(Boolean openStatus) {

public void updateWaitingStatus(Boolean waitingStatus) {
this.waitingStatus = waitingStatus;
this.autoDisabled = false;
}

public void checkStatus() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public record PubRegisterRequest(String pubName,
String oneLiner,
String instagramUrl,
Integer hours,
Integer minutes,
String menuUrl,
Boolean openStatus,
Boolean waitingStatus) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public Pub createPub(PubRegisterRequest request) {
return Pub.create(request.pubName(),
request.oneLiner(),
request.instagramUrl(),
request.hours(),
request.minutes(),
request.menuUrl(),
request.openStatus(),
request.waitingStatus(),
Expand Down

0 comments on commit 9746b61

Please sign in to comment.