From 599708cd579a3a0e30df8c7a71fe04f3682da14e Mon Sep 17 00:00:00 2001 From: Rafael Marques Date: Wed, 4 Sep 2024 19:06:44 -0300 Subject: [PATCH] fix: translation date check --- fastapi_translations/cli.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fastapi_translations/cli.py b/fastapi_translations/cli.py index 1a95d78..e924a6c 100644 --- a/fastapi_translations/cli.py +++ b/fastapi_translations/cli.py @@ -86,8 +86,12 @@ def report( original_doc_date = git.get_commit_date_for( os.path.join(root, file) ) + translation_is_outdated = False translated_date = git.get_commit_date_for(translated_path) + if translated_date and original_doc_date: + translation_is_outdated = translated_date > original_doc_date + doc = DocFile( translation_lang=lang.value, original_file=os.path.join(root, file), @@ -95,7 +99,7 @@ def report( translation_file=translated_path, translation_exists=translation_exists, translation_commit=translated_date, - translation_is_outdated=translation_exists + translation_is_outdated=translation_is_outdated ) summary.append_file(doc) printer.print_table(summary, console, 10)