From 5a52e945fdc25b91674dccf5c6dcd64a8dd1aaae Mon Sep 17 00:00:00 2001 From: stan Date: Tue, 18 Feb 2025 12:31:13 +0000 Subject: [PATCH 1/8] Put nav in right corner --- metadata.html.jinja | 2 ++ style.css | 8 ++++++++ template.html.jinja | 2 ++ 3 files changed, 12 insertions(+) diff --git a/metadata.html.jinja b/metadata.html.jinja index ba1bed664..ec443b791 100644 --- a/metadata.html.jinja +++ b/metadata.html.jinja @@ -7,7 +7,9 @@

Python Docs Translation Dashboard

+
+
diff --git a/style.css b/style.css index 4bc9eb75e..569f24801 100644 --- a/style.css +++ b/style.css @@ -45,6 +45,11 @@ td[data-label="completion"] { width: 100%; line-height: 0; } +.switchpages{ + position:absolute; + top:10px; + right: 10px; + } @media screen and (max-width: 600px) { table, thead, tbody, th, td, tr { display: block; @@ -77,4 +82,7 @@ td[data-label="completion"] { min-width: 0; width: 100% !important; } + .switchpages{ + all: unset; + } } diff --git a/template.html.jinja b/template.html.jinja index 306c1e0f3..9fc0d936c 100644 --- a/template.html.jinja +++ b/template.html.jinja @@ -8,7 +8,9 @@

Python Docs Translation Dashboard

+
+
From 985f7c630b9f1b4e01b79768fdc01d937523a2da Mon Sep 17 00:00:00 2001 From: stan Date: Tue, 18 Feb 2025 13:32:18 +0000 Subject: [PATCH 2/8] Add changes to meta table --- completion.py | 2 +- generate_metadata.py | 2 ++ metadata.html.jinja | 4 ++++ visitors.py | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/completion.py b/completion.py index 56f0f96ae..567130ffc 100644 --- a/completion.py +++ b/completion.py @@ -70,7 +70,7 @@ def get_completion( change = completion - month_ago_completion - return completion, translators_data, branch or None, change + return completion, translators_data, branch, change @dataclass(frozen=True) diff --git a/generate_metadata.py b/generate_metadata.py index a7d90b700..6dc4ee4f4 100644 --- a/generate_metadata.py +++ b/generate_metadata.py @@ -102,11 +102,13 @@ def get_language_repo_branch_and_completion( completion_progress = [ dacite.from_dict(LanguageProjectData, project) for project in index_json ] + changes = [project.change for project in completion_progress] output = template.render( metadata=zip(completion_progress, get_projects_metadata(completion_progress)), generation_time=generation_time, duration=(datetime.now(timezone.utc) - generation_time).seconds, + change=changes, ) Path('metadata.html').write_text(output) diff --git a/metadata.html.jinja b/metadata.html.jinja index ec443b791..442527f21 100644 --- a/metadata.html.jinja +++ b/metadata.html.jinja @@ -17,6 +17,7 @@ + @@ -30,6 +31,9 @@ + + {% endfor %} diff --git a/visitors.py b/visitors.py index 8876651b6..2c067ad68 100644 --- a/visitors.py +++ b/visitors.py @@ -14,7 +14,7 @@ def get_number_of_visitors(language: str, http: PoolManager) -> int: response = http.request( 'GET', f'https://plausible.io/docs.python.org/export?{params}', - retries=Retry(status_forcelist=(500,502)), + retries=Retry(status_forcelist=(500, 502)), ) info(f'visitors {response.status=} ({language=})') with ( From e8ad0a4fe5414c48e97abdea4c3739e7446cedca Mon Sep 17 00:00:00 2001 From: stan Date: Tue, 18 Feb 2025 14:47:31 +0000 Subject: [PATCH 3/8] Fix & make pre-commit happy --- completion.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/completion.py b/completion.py index 567130ffc..c98505a0e 100644 --- a/completion.py +++ b/completion.py @@ -22,7 +22,7 @@ def branches_from_devguide(devguide_dir: Path) -> list[str]: def get_completion( clones_dir: str, repo: str -) -> tuple[float, 'TranslatorsData', str, float]: +) -> tuple[float, 'TranslatorsData', str | None, float]: clone_path = Path(clones_dir, repo) for branch in branches_from_devguide(Path(clones_dir, 'devguide')) + [ 'master', @@ -70,7 +70,7 @@ def get_completion( change = completion - month_ago_completion - return completion, translators_data, branch, change + return completion, translators_data, branch or None, change @dataclass(frozen=True) From 9f42583423cacb4b5fce79b7af993ff026fc024a Mon Sep 17 00:00:00 2001 From: stan Date: Tue, 18 Feb 2025 16:05:36 +0000 Subject: [PATCH 4/8] Suggestion from Maciek --- generate_metadata.py | 2 -- metadata.html.jinja | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/generate_metadata.py b/generate_metadata.py index 6dc4ee4f4..a7d90b700 100644 --- a/generate_metadata.py +++ b/generate_metadata.py @@ -102,13 +102,11 @@ def get_language_repo_branch_and_completion( completion_progress = [ dacite.from_dict(LanguageProjectData, project) for project in index_json ] - changes = [project.change for project in completion_progress] output = template.render( metadata=zip(completion_progress, get_projects_metadata(completion_progress)), generation_time=generation_time, duration=(datetime.now(timezone.utc) - generation_time).seconds, - change=changes, ) Path('metadata.html').write_text(output) diff --git a/metadata.html.jinja b/metadata.html.jinja index 442527f21..db6fa2bcc 100644 --- a/metadata.html.jinja +++ b/metadata.html.jinja @@ -32,7 +32,7 @@ {% if project.completion %}{{ metadata[1] }}{% else %}{{ metadata[1] }}{% endif %} + {% endfor %} From 9d9c803062f59cc6ad62447c591fd34d3aeb18a8 Mon Sep 17 00:00:00 2001 From: stan Date: Tue, 18 Feb 2025 18:51:29 +0000 Subject: [PATCH 5/8] Remove extra tag --- metadata.html.jinja | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metadata.html.jinja b/metadata.html.jinja index db6fa2bcc..9edc3a817 100644 --- a/metadata.html.jinja +++ b/metadata.html.jinja @@ -31,8 +31,8 @@ - + {% endfor %} From 7b739f5b79def496312d74a5757f3263af2c15f2 Mon Sep 17 00:00:00 2001 From: stan Date: Tue, 18 Feb 2025 18:55:09 +0000 Subject: [PATCH 6/8] Minor improvement --- metadata.html.jinja | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metadata.html.jinja b/metadata.html.jinja index 9edc3a817..71b0aa874 100644 --- a/metadata.html.jinja +++ b/metadata.html.jinja @@ -17,7 +17,7 @@ - + @@ -32,7 +32,7 @@ {% if project.completion %}{{ metadata[1] }}{% else %}{{ metadata[1] }}{% endif %} {% endfor %} From 4f53ef8080173ddcef8854f173f14c61660ad26f Mon Sep 17 00:00:00 2001 From: stan Date: Thu, 20 Feb 2025 16:35:40 +0000 Subject: [PATCH 7/8] increase pixels --- style.css | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/style.css b/style.css index 569f24801..10284701c 100644 --- a/style.css +++ b/style.css @@ -50,6 +50,13 @@ td[data-label="completion"] { top:10px; right: 10px; } + +@media screen and (max-width: 675px) { + .switchpages{ + all: unset; + } +} + @media screen and (max-width: 600px) { table, thead, tbody, th, td, tr { display: block; @@ -82,7 +89,4 @@ td[data-label="completion"] { min-width: 0; width: 100% !important; } - .switchpages{ - all: unset; - } } From 3b20e50906a93624dbabb124199e35f7fc6e7179 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Date: Mon, 24 Feb 2025 16:52:30 +0000 Subject: [PATCH 8/8] Apply suggestions from code review Co-authored-by: Maciej Olko --- metadata.html.jinja | 6 +++--- template.html.jinja | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/metadata.html.jinja b/metadata.html.jinja index 71b0aa874..f77b83fd0 100644 --- a/metadata.html.jinja +++ b/metadata.html.jinja @@ -7,9 +7,9 @@

Python Docs Translation Dashboard

-
- -
+
branch build warnings* lint failureschange this month
{% if project.completion %}{{ metadata[1] }}{% else %}{{ metadata[1] }}{% endif %} + {{ "{:.2f}".format(project.completion) }}%
- {{ "{:.2f}".format(project.completion) }}%{{ "{:.2f}".format(project.change) }}%
{% if project.completion %}{{ metadata[1] }}{% else %}{{ metadata[1] }}{% endif %} - {{ "{:.2f}".format(project.change) }}% + {{ "{:.2f}".format(project.change) }}%
branch build warnings* lint failureschange this month30 days change
- {{ "{:.2f}".format(project.change) }}% + +{{ "{:.2f}".format(project.change) }}%
diff --git a/template.html.jinja b/template.html.jinja index 9fc0d936c..c92dc472e 100644 --- a/template.html.jinja +++ b/template.html.jinja @@ -8,9 +8,9 @@

Python Docs Translation Dashboard

-
- -
+