From a192eb07a22db22c4de3586d0ad6386093f61f98 Mon Sep 17 00:00:00 2001 From: cmaddox5 Date: Thu, 25 Apr 2024 13:34:10 -0400 Subject: [PATCH] Added another condition for screens that are updated but have the same ID. --- lib/screenplay/config/permanent_config.ex | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/screenplay/config/permanent_config.ex b/lib/screenplay/config/permanent_config.ex index 1e983da5..81ccc5ef 100644 --- a/lib/screenplay/config/permanent_config.ex +++ b/lib/screenplay/config/permanent_config.ex @@ -184,18 +184,24 @@ defmodule Screenplay.Config.PermanentConfig do new_screens ++ updated_pending_screens end) |> Enum.reduce({[], [], []}, fn screen, - {new_screen_ids, changed_screen_ids, deleted_screen_ids} -> + {new_screen_ids, changed_screen_ids, deleted_screen_ids} = + acc -> cond do screen["is_deleted"] -> {new_screen_ids, changed_screen_ids, [screen["screen_id"] | deleted_screen_ids]} + # new screen screen["new_id"] != nil and screen["screen_id"] == nil -> {[screen["new_id"] | new_screen_ids], changed_screen_ids, deleted_screen_ids} # screen is existing but had its ID changed. - true -> - {[screen["new_id"] | new_screen_ids], [screen | changed_screen_ids], + screen["new_id"] != nil and screen["screen_id"] != nil -> + {[screen["new_id"] | new_screen_ids], [screen["screen_id"] | changed_screen_ids], deleted_screen_ids} + + # existing screen is being updated but did not change IDs + true -> + acc end end)