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

Fix/updateRoute #90

Merged
merged 3 commits into from
Mar 25, 2024
Merged

Fix/updateRoute #90

merged 3 commits into from
Mar 25, 2024

Conversation

Bouba-cassation
Copy link
Collaborator

Issue description :

  • update documents route and put status done for automatic documents
  • adding prompt to ask you if you wanna run the script

Describe your changes :

  • I change updateRouteById
    if (updatedDocument?.route == 'automatic') { await this.updateStatusById(_id, 'done'); }

How to test :

Make some changes in your storage folder, put an automatic code => in documents
"NACCode": "11A", "NPCode": "11A", "endCaseCode": "11A",

Checklist before requesting a review

  • I have performed a self-review of my code.
  • The feature works locally.
  • If it's relevant I added tests.
  • [] Will this be part of a product update? If yes, please write one phrase about this update.

@ajeanneney ajeanneney changed the title Feature/extract route done Fix/updateRoute Mar 25, 2024
@@ -119,7 +119,7 @@ prod label script exportSpecificDocument --documentNumber=10000 --source=jurinet

In Wallix, with a Cygwin terminal:
```
prod label script updateRoute --status=free
prod label script updateRouteForFreeDocuments --status=free
Copy link
Collaborator

Choose a reason for hiding this comment

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

A l'occasion il faudra qu'on mette a jour/supprime ce readme qui n'est plus a jour 😆

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Pas que le readme @ajeanneney

@@ -27,6 +28,10 @@ function extractRoute(
switch (source) {
case 'jurinet':
try {
logger.error({
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
logger.error({
logger.log({

c'est pas encore une erreur a ce niveau la ;)

Copy link
Collaborator Author

@Bouba-cassation Bouba-cassation Mar 25, 2024

Choose a reason for hiding this comment

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

C'est un logger qui doit être supprimer, j'ai du l'oublier

@@ -27,6 +28,10 @@ function extractRoute(
switch (source) {
case 'jurinet':
try {
logger.error({
operationName: 'extractRouteForJurinet',
msg: `${routeInfos}`,
Copy link
Collaborator

Choose a reason for hiding this comment

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

"extractRouteForJurinet","msg":"[object Object]" ça log ça ducoup :/

docker container exec -it label_backend_1 sh -c "cd packages/courDeCassation; sh scripts/runLocalScript.sh ./dist/scripts/updateRoute.js" pour tester en local 😉

Et enfait mieux vaut ne pas logger les routeInfos, il y a les parties dedans (données sensibles)

@@ -119,7 +119,7 @@ prod label script exportSpecificDocument --documentNumber=10000 --source=jurinet

In Wallix, with a Cygwin terminal:
```
prod label script updateRoute --status=free
prod label script updateRouteForFreeDocuments --status=free
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
prod label script updateRouteForFreeDocuments --status=free
prod label script updateRouteForFreeDocuments

});
const { environment, settings } = await parametersHandler.getParameters();
prompt.question(
'Confirmez vous le lancement de ce script (yes/no)? ',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
'Confirmez vous le lancement de ce script (yes/no)? ',
'Voulez vous mettre a jour le circuit de relecture de tous les documents free (yes/no)? ',

Sinon bien vu le message de confirmation 🆗

@@ -59,20 +73,3 @@ async function updateRoute(status: documentType['status']) {
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
);
);
if(newRoute === 'automatic'){
documentRepository.updateStatusById(documentsToUpdate[index]._id, "done");
}

Je pense que c'est mieux de mettre la logique ici :

  • ça évite d'avoir de la logique dans le repository
  • a cette endroit on est sur que le document est en status free car c'est défini en dur dans le code, le risque selon moi de le mettre dans le repository est que le updateStatusById soit appelé dans un autre contexte qui peut poser problème. Si un jour on appelle updateRouteById sur un document loaded et que sa nouvelle route est automatique alors il passe a done alors qu'il n'est pas annoté par le moteur

@@ -216,6 +216,9 @@ const buildDocumentRepository = buildRepositoryBuilder<
async updateRouteById(_id, route) {
await collection.updateOne({ _id }, { $set: { route } });
const updatedDocument = await collection.findOne({ _id });
if (updatedDocument?.route == 'automatic') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

je préfère qu'on ne mette pas la logique dans le repository, cf. commentaire plus haut

@Bouba-cassation Bouba-cassation merged commit e97412e into dev Mar 25, 2024
2 checks passed
@ajeanneney ajeanneney deleted the feature/extractRouteDone branch March 25, 2024 13:28
Bouba-cassation added a commit that referenced this pull request Mar 25, 2024
* Feature/appeal number 399 (#82)

* adding regex to get registreNUmber || pourvoie

* adding logique to extract RG or Appeal or NumeroRoleGeneral for title in label

* renaming and resolving bug

* renaming and resolving bug

* rename and lint

* optimisation of code

* little clean

* updating sder commit

---------

Co-authored-by: Antoine Jeanneney <[email protected]>

* Fix/updateRoute (#90)

* updating status to done for automatic route decisions

* updating readme

* updating antoine's request

---------

Co-authored-by: Antoine Jeanneney <[email protected]>
s-diallo pushed a commit that referenced this pull request Oct 8, 2024
* updating status to done for automatic route decisions

* updating readme

* updating antoine's request
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