Skip to content

Commit

Permalink
Merge pull request #55 from Thorfusion/dev
Browse files Browse the repository at this point in the history
if mod already exist in modpackbuild, replace entry instead of making new
  • Loading branch information
maggi373 authored May 26, 2024
2 parents 444a582 + 67cd8d2 commit 145ef0e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.1.0"
__version__ = "1.1.1"

import os
from dotenv import load_dotenv
Expand Down
16 changes: 16 additions & 0 deletions models/modversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,23 @@ def add_modversion_to_selected_build(cls, modver_id, mod_id, build_id, marked, o
if marked == "1":
cur.execute("SELECT id FROM builds WHERE marked = 1")
build_id = cur.fetchone()["id"]
conn.commit()
# when new modversion is added to build, old modversion gets deleted, quite tricky as both values are unique each time and you need to get all modversion and delete them on said build.
cur.execute(
"""SELECT build_modversion.id, modversions.id AS modverid, modversions.mod_id AS modid
FROM build_modversion
INNER JOIN modversions ON build_modversion.modversion_id = modversions.id
WHERE build_id = %s AND modversions.mod_id = %s
"""
, (build_id, mod_id))
try:
build_modid = cur.fetchone()["id"]
except:
build_modid = None
if build_modid is not None:
cur.execute("UPDATE build_modversion SET modversion_id = %s WHERE id = %s AND build_id = %s", (modver_id, build_modid, build_id))
conn.commit()
return None
cur.execute("SELECT * FROM modversions WHERE mod_id = %s", (mod_id,))
modversions = cur.fetchall()
if modversions:
Expand Down
2 changes: 1 addition & 1 deletion templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
</ul>
</nav>
<div class="flex-column flex-shrink-0 p-3 text-white navcontainer2">
<p class="">Version 1.1.0</p>
<p class="">Version 1.1.1</p>
</div>

</div>
Expand Down

0 comments on commit 145ef0e

Please sign in to comment.