Skip to content

Commit

Permalink
도보 예상 시간 분 단위 반환하도록 수정 (#79)
Browse files Browse the repository at this point in the history
* feat: 도보 예상 시간 분 단위 반환하도록 수정

* 출력문 제거
  • Loading branch information
youngh0 authored Jun 4, 2024
1 parent b724668 commit a461384
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public boolean containsPayType(Set<PayType> memberPayTypes) {
public int calculateWalkingTime(Location destination) {
double distance = calculateDistanceToDestination(destination);
double averageWalkingTime = distance / AVERAGE_WALKING_SPEED;
return (int) Math.ceil(averageWalkingTime);
return (int) Math.ceil(averageWalkingTime * 60);
}

private double calculateDistanceToDestination(Location destination) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
package com.parkingcomestrue.common.domain.parking;

import com.parkingcomestrue.common.domain.parking.BaseInformation;
import com.parkingcomestrue.common.domain.parking.Fee;
import com.parkingcomestrue.common.domain.parking.FeePolicy;
import com.parkingcomestrue.common.domain.parking.FreeOperatingTime;
import com.parkingcomestrue.common.domain.parking.Location;
import com.parkingcomestrue.common.domain.parking.OperatingTime;
import com.parkingcomestrue.common.domain.parking.Parking;
import com.parkingcomestrue.common.domain.parking.Space;
import com.parkingcomestrue.common.domain.parking.TimeUnit;
import java.util.stream.Stream;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
Expand All @@ -21,7 +12,8 @@ class ParkingTest {
@Test
void 목적지와_68미터_떨어진_주차장_도보_예상시간_계산() {
// given (parking 과 destination 거리 68m)
int expectedTime = (int) Math.ceil(0.068 / 5);
// 0.068 / 5 * 60
int expectedTime = 1;
Parking parking = Parking.builder()
.location(Location.of(127.1215865, 37.4811181))
.build();
Expand All @@ -36,8 +28,9 @@ class ParkingTest {

@Test
void 목적지와_333미터_떨어진_주차장_도보_예상시간_계산() {
// given (parking 과 destination 거리 68m)
int expectedTime = (int) Math.ceil(0.333 / 5);
// given (parking 과 destination 거리 333m)
// 0.333 / 5 * 60
int expectedTime = 5;
Parking parking = Parking.builder()
.location(Location.of(127.1215865, 37.4811181))
.build();
Expand Down

0 comments on commit a461384

Please sign in to comment.