-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from bouanani-soufiane/PIG-30-gestion-des-resu…
…ltats Pig 30 gestion des resultats
- Loading branch information
Showing
40 changed files
with
414 additions
and
60 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
src/main/java/ma/yc/PigeonSkyRace/common/application/service/Helper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package ma.yc.PigeonSkyRace.common.application.service; | ||
|
||
import ma.yc.PigeonSkyRace.competition.domain.ValueObject.Coordinate; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class Helper { | ||
|
||
public static double calculateDistance(Coordinate loftCoordinate, Coordinate competitionCoordinate) { | ||
|
||
double loftLatRad = Math.toRadians(loftCoordinate.latitude()); | ||
double loftLonRad = Math.toRadians(loftCoordinate.longitude()); | ||
double competitionLatRad = Math.toRadians(competitionCoordinate.latitude()); | ||
double competitionLonRad = Math.toRadians(competitionCoordinate.longitude()); | ||
|
||
double deltaLat = competitionLatRad - loftLatRad; | ||
double deltaLon = competitionLonRad - loftLonRad; | ||
double a = Math.sin(deltaLat / 2) * Math.sin(deltaLat / 2) | ||
+ Math.cos(loftLatRad) * Math.cos(competitionLatRad) | ||
* Math.sin(deltaLon / 2) * Math.sin(deltaLon / 2); | ||
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); | ||
|
||
return 6371.01 * c; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
.../java/ma/yc/PigeonSkyRace/competition/application/dto/request/SeasonPigeonRequestDTO.java
This file was deleted.
Oops, something went wrong.
7 changes: 3 additions & 4 deletions
7
.../java/ma/yc/PigeonSkyRace/competition/application/dto/request/SeasonPigeonRequestDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
package ma.yc.PigeonSkyRace.competition.application.dto.request; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import ma.yc.PigeonSkyRace.competition.domain.ValueObject.SeasonId; | ||
import ma.yc.PigeonSkyRace.competition.domain.entity.Season; | ||
import ma.yc.PigeonSkyRace.piegon.domain.model.aggregate.Pigeon; | ||
import ma.yc.PigeonSkyRace.piegon.domain.model.valueObject.PigeonId; | ||
|
||
public record SeasonPigeonRequestDto( | ||
@NotNull Pigeon pigeon, | ||
@NotNull Season season | ||
) { | ||
public record SeasonPigeonRequestDto(@NotNull Pigeon pigeon ,@NotNull Season season) { | ||
} |
4 changes: 0 additions & 4 deletions
4
...ava/ma/yc/PigeonSkyRace/competition/application/dto/response/SeasonPigeonResponseDTO.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...va/ma/yc/PigeonSkyRace/competition/application/service/CompetitionApplicationService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package ma.yc.PigeonSkyRace.competition.application.service; | ||
|
||
import ma.yc.PigeonSkyRace.competition.application.dto.response.CompetitionResponseDto; | ||
import ma.yc.PigeonSkyRace.competition.domain.ValueObject.CompetitionId; | ||
import ma.yc.PigeonSkyRace.competition.domain.entity.Competition; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
public interface CompetitionApplicationService { | ||
CompetitionResponseDto getCompetition(CompetitionId id); | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
...yc/PigeonSkyRace/competition/application/service/CompetitionPigeonApplicationService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package ma.yc.PigeonSkyRace.competition.application.service; | ||
|
||
import ma.yc.PigeonSkyRace.competition.domain.ValueObject.CompetitionPigeonId; | ||
import ma.yc.PigeonSkyRace.competition.domain.entity.Competition; | ||
import ma.yc.PigeonSkyRace.competition.domain.entity.CompetitionPigeon; | ||
import ma.yc.PigeonSkyRace.competition.domain.entity.SeasonPigeon; | ||
|
||
import javax.swing.text.html.Option; | ||
import java.util.Optional; | ||
|
||
public interface CompetitionPigeonApplicationService { | ||
CompetitionPigeon findBySeasonPigeonAndCompetition(SeasonPigeon seasonPigeon, Competition competition); | ||
CompetitionPigeon findById(CompetitionPigeonId id); | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
...a/ma/yc/PigeonSkyRace/competition/application/service/SeasonPigeonApplicationService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package ma.yc.PigeonSkyRace.competition.application.service; | ||
|
||
import ma.yc.PigeonSkyRace.competition.domain.entity.Season; | ||
import ma.yc.PigeonSkyRace.competition.domain.entity.SeasonPigeon; | ||
import ma.yc.PigeonSkyRace.piegon.domain.model.aggregate.Pigeon; | ||
|
||
public interface SeasonPigeonApplicationService { | ||
SeasonPigeon findSeasonPigeonPigeonAndSeason(Season season, Pigeon pigeon); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
src/main/java/ma/yc/PigeonSkyRace/competition/domain/service/CompetitionPigeonService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/main/java/ma/yc/PigeonSkyRace/piegon/application/service/LoftApplicationService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/main/java/ma/yc/PigeonSkyRace/piegon/application/service/PigeonApplicationService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
package ma.yc.PigeonSkyRace.piegon.application.service; | ||
|
||
import ma.yc.PigeonSkyRace.piegon.domain.model.aggregate.Pigeon; | ||
import ma.yc.PigeonSkyRace.piegon.domain.model.valueObject.BandNumber; | ||
import ma.yc.PigeonSkyRace.piegon.domain.model.valueObject.PigeonId; | ||
|
||
public interface PigeonApplicationService { | ||
Pigeon findPigeonById ( PigeonId value ); | ||
Pigeon findPigeonByBandNumber ( BandNumber value ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.