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 missing translations when there is more than one release for a language #181

Merged
merged 3 commits into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions src/gtnh/modpack_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,13 @@ async def update_versions_from_repo(

for release in sorted_releases:
if asset.has_version(release.tag_name):
# We don't support updating of tagged versions, so if we see a version we already have, skip it
# and the rest of the versions
break
if for_translation:
# Just skip it if we find a duplicate translation release, don't bail entirely
continue
else:
# We don't support updating of tagged versions, so if we see a version we already have, skip it
# and the rest of the versions
break

version = version_from_release(release, asset.type)
if not version:
Expand All @@ -308,16 +312,16 @@ async def update_versions_from_repo(
)
continue

if not for_translation and version_is_newer(version.version_tag, asset.latest_version):
if for_translation:
log.info(
f"Updating latest version for `{Fore.CYAN}{asset.name}{Fore.RESET}` "
f"{Style.DIM}{Fore.GREEN}{asset.latest_version}{Style.RESET_ALL} -> "
f"Updating version for `{Fore.CYAN}{asset.name}{Fore.RESET}` -> "
f"{Fore.GREEN}{version.version_tag}{Style.RESET_ALL}"
)
asset.latest_version = version.version_tag
elif for_translation:
elif version_is_newer(version.version_tag, asset.latest_version):
log.info(
f"Updating version for `{Fore.CYAN}{asset.name}{Fore.RESET}` -> "
f"Updating latest version for `{Fore.CYAN}{asset.name}{Fore.RESET}` "
f"{Style.DIM}{Fore.GREEN}{asset.latest_version}{Style.RESET_ALL} -> "
f"{Fore.GREEN}{version.version_tag}{Style.RESET_ALL}"
)
asset.latest_version = version.version_tag
Expand Down
Loading