Skip to content

Commit

Permalink
Keep ordering of newly added screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
bartaz committed Apr 4, 2019
1 parent 831cc65 commit bfa62c6
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions webapp/publisher/snaps/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ def build_changed_images(
info = []
images_files = []
images_json = None

# Get screenshots info (existing and new) while keeping the order recieved
for changed_screenshot in changed_screenshots:
for current_screenshot in current_screenshots:
if (
Expand All @@ -171,15 +173,7 @@ def build_changed_images(
):
info.append(current_screenshot)
break

# Add new icon
if icon is not None:
info.append(build_image_info(icon, "icon"))
images_files.append(icon)

# Add new screenshots
for new_screenshot in new_screenshots:
for changed_screenshot in changed_screenshots:
for new_screenshot in new_screenshots:
is_same = (
changed_screenshot["status"] == "new"
and changed_screenshot["name"] == new_screenshot.filename
Expand All @@ -190,6 +184,12 @@ def build_changed_images(
if image_built not in info:
info.append(image_built)
images_files.append(new_screenshot)
break

# Add new icon
if icon is not None:
info.append(build_image_info(icon, "icon"))
images_files.append(icon)

images_json = {"info": dumps(info)}

Expand Down

0 comments on commit bfa62c6

Please sign in to comment.