Skip to content
This repository has been archived by the owner on Mar 11, 2023. It is now read-only.

Added the "--json" option. #45

Merged
merged 6 commits into from
Dec 28, 2019
Merged

Added the "--json" option. #45

merged 6 commits into from
Dec 28, 2019

Conversation

awecx
Copy link
Collaborator

@awecx awecx commented Dec 16, 2019

Closes #10

@Seluj78
Copy link
Collaborator

Seluj78 commented Dec 16, 2019

Example output

(potodo) ➜  potodo git:(json) potodo -p tests/fixtures/python-docs-fr


# library (20.00% done)

- token.po                        13 /  65 ( 20.0% translated), 3 fuzzy


# python-docs-fr (87.33% done)

- bugs.po                         25 /  26 ( 96.0% translated)
- obsolete.po                      2 /   3 ( 66.0% translated)
(potodo) ➜  potodo git:(json) potodo -p tests/fixtures/python-docs-fr -j
[
    {
        "name": "library/",
        "pc_translated": 20.0,
        "files": [
            {
                "name": "library/token",
                "path": "tests/fixtures/python-docs-fr/library/token.po",
                "entries": 65,
                "fuzzies": 3,
                "translated": 13,
                "pc_translated": 20,
                "reserved_by": null
            }
        ]
    },
    {
        "name": "python-docs-fr/",
        "pc_translated": 87.33,
        "files": [
            {
                "name": "python-docs-fr/bugs",
                "path": "tests/fixtures/python-docs-fr/bugs.po",
                "entries": 26,
                "fuzzies": 0,
                "translated": 25,
                "pc_translated": 96,
                "reserved_by": null
            },
            {
                "name": "python-docs-fr/bsolete",
                "path": "tests/fixtures/python-docs-fr/obsolete.po",
                "entries": 3,
                "fuzzies": 0,
                "translated": 2,
                "pc_translated": 66,
                "reserved_by": null
            }
        ]
    }
]

@awecx
Copy link
Collaborator Author

awecx commented Dec 16, 2019

(je corrige black)

@awecx
Copy link
Collaborator Author

awecx commented Dec 16, 2019

Sinon tu penses quoi du format du JSON ?
Y'a encore 2-3 choses dans le code que je n'aime pas trop sinon. Je vais peut-être refaire une passe demain soir.

Seluj78
Seluj78 previously approved these changes Dec 16, 2019
Copy link
Collaborator

@Seluj78 Seluj78 left a comment

Choose a reason for hiding this comment

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

Super PR ! approved dans l'ensemble mais qq commentaires

potodo/potodo.py Outdated Show resolved Hide resolved
potodo/potodo.py Outdated Show resolved Hide resolved
potodo/potodo.py Outdated Show resolved Hide resolved
potodo/potodo.py Outdated Show resolved Hide resolved
potodo/potodo.py Outdated Show resolved Hide resolved
@awecx awecx requested a review from Seluj78 December 17, 2019 08:41
Seluj78
Seluj78 previously approved these changes Dec 17, 2019
Copy link
Collaborator

@Seluj78 Seluj78 left a comment

Choose a reason for hiding this comment

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

LGTM ! 🎉

@awecx
Copy link
Collaborator Author

awecx commented Dec 17, 2019

J'ai ajouté des tests (ça a déjà payé, j'ai aussi corrigé un bogue) :

[
        {
            "name": "folder/",
            "percent_translated": 0.0,
            "files": [
                {
                    "name": "folder/file3",
                    "path": str(FIXTURE_DIR / REPO_DIR / "folder" / "file3.po"),
                    "entries": 1,
                    "fuzzies": 0,
                    "translated": 0,
                    "percent_translated": 0,
                    "reserved_by": None,
                },
            ],
        },
        {
            "name": "python-docs-fr/",
            "percent_translated": 16.5,
            "files": [
                {
                    "name": "python-docs-fr/file1",
                    "path": str(FIXTURE_DIR / REPO_DIR / "file1.po"),
                    "entries": 3,
                    "fuzzies": 1,
                    "translated": 1,
                    "percent_translated": 33,
                    "reserved_by": None,
                },
                {
                    "name": "python-docs-fr/file2",
                    "path": str(FIXTURE_DIR / REPO_DIR / "file2.po"),
                    "entries": 1,
                    "fuzzies": 0,
                    "translated": 0,
                    "percent_translated": 0,
                    "reserved_by": None,
                },
            ],
        },
    ]

Il y a 2-3 trucs à améliorer sur la sortie ;

  • on pourrait mettre « / » au lieu de « python-docs-fr » pour désigner le dossier racine ;
  • mettre le « percent_translated » du fichier en décimal ;
  • enrichir la description du dossier avec « entries », « fuzzies », « translated » aggrégés ;
  • ne pas moyenner le « percent_translated » du dossier sur le « percent_translated » des fichiers (on a dans l'exemple 4 entrées dont une seule traduite donc 25% pas 16,5%).

Je corrigerai ça dans une autre PR demain ou jeudi.

@Seluj78 Seluj78 mentioned this pull request Dec 18, 2019
tests/fixtures/python-docs-fr/folder/file3.po Outdated Show resolved Hide resolved
tests/test_potodo.py Show resolved Hide resolved
tests/test_potodo.py Show resolved Hide resolved
@awecx
Copy link
Collaborator Author

awecx commented Dec 27, 2019

@Seluj78 ping ?

Copy link
Collaborator

@Seluj78 Seluj78 left a comment

Choose a reason for hiding this comment

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

🎉

@awecx awecx merged commit 0f9da46 into master Dec 28, 2019
@awecx awecx deleted the json branch December 28, 2019 17:41
@awecx
Copy link
Collaborator Author

awecx commented Dec 28, 2019

Merci @Seluj78 pour les revues. Je vais voir pour #46.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add json output option
2 participants