Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(action): update mission action #452

Merged
merged 9 commits into from
Dec 25, 2024

Conversation

xtiannyeto
Copy link
Collaborator

  • GraphQl definition of controller method and input
  • useCase of update env, nav, fish
  • useCase of compute controls
  • useCase of compute infractions
  • useCase of compute infraction env target
  • Tests

 - GraphQl definition of controller method and input
 - useCase of update env, nav, fish
 - useCase of compute controls
 - useCase of compute infractions
 - useCase of compute infraction env target
 - Tests
Copy link

github-actions bot commented Dec 11, 2024

Coverage Report for frontend

Status Category Percentage Covered / Total
🟢 Lines 76.21% (🎯 50%) 1971 / 2586
🟢 Statements 76.1% (🎯 50%) 2051 / 2695
🟢 Functions 73.09% (🎯 50%) 508 / 695
🟢 Branches 68.73% (🎯 50%) 910 / 1324
File CoverageNo changed files found.
Generated in workflow #1436 for commit 7855cff by the Vitest Coverage Report Action

Copy link

Overall Project 49.94% -1.01%
Files changed 80.62% 🍏

File Coverage
ProcessMissionActionInfraction.kt 96.49% -3.51% 🍏
MissionActionInput.kt 96.2% -3.8% 🍏
MissionFishActionEntity.kt 95.03% -4.57% 🍏
MissionFishActionDataInput.kt 92.47% -7.53% 🍏
MissionEnvActionDataInput.kt 91.07% -8.93% 🍏
UpdateFishAction.kt 90.43% -9.57% 🍏
MissionFishActionOutput.kt 90.18% -3.65%
UpdateEnvAction.kt 89% -11% 🍏
ProcessMissionActionInfractionEnvTarget.kt 88.83% -11.17% 🍏
ControlSecurityEntity.kt 88.32% -8.12%
UpdateNavAction.kt 87.32% -12.68% 🍏
MissionNavActionDataInput.kt 87.18% -12.82% 🍏
ControlNavigationEntity.kt 85.28% -11.17%
GetEnvActionById.kt 84.62% 🍏
ControlAdministrativeEntity.kt 79.26% -19.73%
ProcessMissionActionControl.kt 77.45% -21.57%
ControlGensDeMerEntity.kt 76.25% -19.06%
MissionActionOutput.kt 73.25% -1.27%
MissionActionDataInput.kt 64.77% -35.23%
ActionControlEntity.kt 63.64% -33.94%
BaseControlEntity.kt 50% -33.9%
MissionFishActionDataOutput.kt 48.15% -1.92%

@xtiannyeto xtiannyeto requested a review from lwih December 11, 2024 08:54
 - mission action controller
Copy link

Overall Project 49.84% -1.18%
Files changed 77.99%

File Coverage
ProcessMissionActionInfraction.kt 96.49% -3.51% 🍏
MissionActionInput.kt 96.2% -3.8% 🍏
MissionFishActionEntity.kt 95.03% -4.57% 🍏
MissionFishActionDataInput.kt 92.47% -7.53% 🍏
MissionEnvActionDataInput.kt 91.07% -8.93% 🍏
UpdateFishAction.kt 90.43% -9.57% 🍏
MissionFishActionOutput.kt 90.18% -3.65%
UpdateEnvAction.kt 89% -11% 🍏
ProcessMissionActionInfractionEnvTarget.kt 88.83% -11.17% 🍏
ControlSecurityEntity.kt 88.32% -8.12%
UpdateNavAction.kt 87.32% -12.68% 🍏
MissionNavActionDataInput.kt 87.18% -12.82% 🍏
ControlNavigationEntity.kt 85.28% -11.17%
GetEnvActionById.kt 84.62% 🍏
ControlAdministrativeEntity.kt 79.26% -19.73%
ProcessMissionActionControl.kt 77.45% -21.57%
ControlGensDeMerEntity.kt 76.25% -19.06%
MissionActionOutput.kt 73.25% -1.27%
MissionActionDataInput.kt 64.77% -35.23%
ActionControlEntity.kt 63.64% -33.94%
BaseControlEntity.kt 50% -33.9%
MissionFishActionDataOutput.kt 48.15% -1.92%
MissionActionController.kt 0% -43.41%

Copy link
Collaborator

@lwih lwih left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C'est bon pour moi et j'ai pigé ta logique.
Je ferai une grosse session de test genre lundi

Comment on lines +17 to +33
override fun hashCode(): Int {
var result = id.hashCode()
result = 31 * result + actionControlId.hashCode()
result = 31 * result + (observations?.hashCode() ?: 0)
result = 31 * result + (hasBeenDone?.hashCode() ?: 0)
return result
}

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as BaseControlEntity
return (id == other.id
&& hasBeenDone == other.hasBeenDone
&& observations == other.observations
&& actionControlId == other.actionControlId)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Par curiosité, ca fait quoi ça ?
Je suis toujours pas clair avec ces hashCode et equals

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je vais checker que les controls sont identiques. s'ils le sont je ne les update pas.
du coup pour vérifier l'égalité == vérifie qu'on à la même adresse dans la heap (la mémoire)
a.equals(b) qu'on a le même contenu
mais quand tu modifies (override) la méthode equals tu dois modifé la méthode hascode
Pourquoi?
hashCode et un méthode de calcul du clé de crypto (le hash)
on a 2 objets: a, b

  • si a.hashcode != b.hashcode alors A et B ne peuvent pas être égaux, c'est le premier check ca ne sert à rien de de faire appel à la méthode equals.
  • si a.hashcode == b.hashcode ca ne veut pas dire qu'ils sont égaux.. mais ca veut dire on peut passer à la suite du check.

@lwih
Copy link
Collaborator

lwih commented Dec 12, 2024

Ah si, un truc que j'ai pas réussi à déterminer en regardant le code mais dans la v1, y a un comportement qu'il faut garder.
Dans l'UI, les utilisateurs peuvent créer une Infraction avec d'avoir créé un Control donc il y avait un bout de code qui, lors de la creation d'une infraction, check si le Control parent existe et si c'est pas le cas, créé le Control parent afin de satisfaire les foreign keys Control<>Infraction. Le fichier est AddOrUpdateInfraction usecase.
Je te laisse vérifier

 - graphql definitions
 - input object update regarding observations
Copy link

Overall Project 49.84% -1.18%
Files changed 77.99%

File Coverage
ProcessMissionActionInfraction.kt 96.49% -3.51% 🍏
MissionActionInput.kt 96.2% -3.8% 🍏
MissionFishActionEntity.kt 95.03% -4.57% 🍏
MissionFishActionDataInput.kt 92.47% -7.53% 🍏
MissionEnvActionDataInput.kt 91.07% -8.93% 🍏
UpdateFishAction.kt 90.43% -9.57% 🍏
MissionFishActionOutput.kt 90.18% -3.65%
UpdateEnvAction.kt 89% -11% 🍏
ProcessMissionActionInfractionEnvTarget.kt 88.83% -11.17% 🍏
ControlSecurityEntity.kt 88.32% -8.12%
UpdateNavAction.kt 87.32% -12.68% 🍏
MissionNavActionDataInput.kt 87.18% -12.82% 🍏
ControlNavigationEntity.kt 85.28% -11.17%
GetEnvActionById.kt 84.62% 🍏
ControlAdministrativeEntity.kt 79.26% -19.73%
ProcessMissionActionControl.kt 77.45% -21.57%
ControlGensDeMerEntity.kt 76.25% -19.06%
MissionActionOutput.kt 73.25% -1.27%
MissionActionDataInput.kt 64.77% -35.23%
ActionControlEntity.kt 63.64% -33.94%
BaseControlEntity.kt 50% -33.9%
MissionFishActionDataOutput.kt 48.15% -1.92%
MissionActionController.kt 0% -43.41%

 - adding new input definitions for controls and infractions
 - control input (administrative, gensDeMer, navigation, security)
 - infractions input
 - tests
 - Update compute control use case
 - update compute infraction use case
 - update compte infraction target use_case
 - create compute control for infraction target
 - Update tests
Copy link

Overall Project 49.8% -2.51%
Files changed 68.99%

File Coverage
MissionNavActionDataInput.kt 99% -1% 🍏
MissionFishActionDataInput.kt 97.91% -2.09% 🍏
MissionActionInput.kt 96.2% -3.8% 🍏
InfractionTargetInput2.kt 96.05% -3.95% 🍏
MissionFishActionEntity.kt 95.03% -4.57% 🍏
ProcessMissionActionInfraction.kt 94.26% -5.74% 🍏
ProcessMissionActionInfractionEnvTarget.kt 93.64% -6.36% 🍏
ActionControlInput.kt 93.13% -6.87% 🍏
UpdateFishAction.kt 91.6% -8.4% 🍏
MissionFishActionOutput.kt 90.18% -3.65%
UpdateNavAction.kt 89.58% -10.42% 🍏
MissionEnvActionDataInput.kt 88.58% -11.42% 🍏
ControlSecurityInput2.kt 87.5% -12.5% 🍏
MissionNavActionEntity.kt 85.22% 🍏
UpdateEnvAction.kt 84.81% -15.19% 🍏
ControlNavigationInput2.kt 84.72% -15.28% 🍏
GetEnvActionById.kt 84.62% 🍏
MissionActionModel.kt 82.73% -0.6%
InfractionInput2.kt 82.09% -17.91% 🍏
ControlGensDeMerInput2.kt 81.87% -18.13% 🍏
ControlSecurityEntity.kt 81.73% -11.17%
ControlNavigationEntity.kt 81.73% -11.17%
ControlAdministrativeInput2.kt 80.11% -19.89% 🍏
ControlAdministrativeEntity.kt 78.6% -20.4%
ControlGensDeMerEntity.kt 74.92% -20.4%
MissionActionOutput.kt 73.25% -1.27%
MissionActionDataInput.kt 69.08% -30.92%
ProcessMissionActionControl.kt 63.42% -35.8%
MissionEnvActionDataOutput.kt 51.16% -24.42%
MissionFishActionDataOutput.kt 48.15% -1.92%
BaseControlInput.kt 45.83% -54.17%
BaseControlEntity.kt 45.76% -38.14%
InfractionEntity.kt 42.9% -48.58%
ActionControlEntity.kt 32.79% -48.09%
InfractionEnvTargetEntity.kt 30.82% -56.27%
MissionActionController.kt 0% -31.13%
ProcessMissionActionControlEnvTarget.kt 0% -94.07%
InfractionByTargetInput2.kt 0% -96.3%

@xtiannyeto xtiannyeto merged commit 5abba35 into main Dec 25, 2024
9 checks passed
@xtiannyeto xtiannyeto deleted the feature/446-hasbeendone-mission-action-tag branch December 25, 2024 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants