Skip to content

Commit

Permalink
Only sort data for the current mod_version
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed Dec 9, 2024
1 parent 3fa8dd2 commit 616ac7e
Showing 1 changed file with 22 additions and 24 deletions.
46 changes: 22 additions & 24 deletions scripts/add_mod_port.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,17 @@ def update_fabric_api_data(mod, mod_version, mc_version, fapi_version):
data[mod_version][mc_version] = fapi_version

# Sort fabric_api by release time and version type
for mod_version in data:
data[mod_version] = {
k: v
for k, v in sorted(
data[mod_version].items(),
key=lambda item: (
version_info[item[0]]["type"] == "release",
version_info[item[0]]["releaseTime"],
),
reverse=True,
)
}
data[mod_version] = {
k: v
for k, v in sorted(
data[mod_version].items(),
key=lambda item: (
version_info[item[0]]["type"] == "release",
version_info[item[0]]["releaseTime"],
),
reverse=True,
)
}

with open(data_file, "w") as f:
json.dump(data, f, indent=2)
Expand All @@ -145,18 +144,17 @@ def update_curseforge_data(mod, modloader, mod_version, mc_version, file_id):
data[mod_version][mc_version] = int(file_id)

# Sort curseforge IDs by release time and version type
for mod_version in data:
data[mod_version] = {
k: v
for k, v in sorted(
data[mod_version].items(),
key=lambda item: (
version_info[item[0]]["type"] == "release",
version_info[item[0]]["releaseTime"],
),
reverse=True,
)
}
data[mod_version] = {
k: v
for k, v in sorted(
data[mod_version].items(),
key=lambda item: (
version_info[item[0]]["type"] == "release",
version_info[item[0]]["releaseTime"],
),
reverse=True,
)
}

with open(data_file, "w") as f:
json.dump(data, f, indent=2)
Expand Down

0 comments on commit 616ac7e

Please sign in to comment.