From 904dd7733beea34aa449f72246746b5a7fdcc8ea Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 11 Jul 2023 15:32:50 +0300 Subject: BugFix: Display diff file only once The code filtering the diffs to ensure that only the diffs for the traits that the user has access to are visible was leading to the diffs that relate to the same trait showing up more than once. This commit fixes that, ensuring that each diff shows up once. --- wqflask/wqflask/metadata_edits.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wqflask/wqflask/metadata_edits.py b/wqflask/wqflask/metadata_edits.py index 7b921a6d..141a6711 100644 --- a/wqflask/wqflask/metadata_edits.py +++ b/wqflask/wqflask/metadata_edits.py @@ -514,12 +514,12 @@ def list_diffs(): def __filter_authorised__(diffs, auth_details): """Retain only those diffs that the current user has edit access to.""" - return [ - diff for diff in diffs + return list({ + diff["filepath"]: diff for diff in diffs for auth in auth_details if (diff["diff"]["dataset_name"] == auth["dataset_name"] - and - diff["diff"]["trait_name"] == auth["trait_name"]) ] + and + diff["diff"]["trait_name"] == auth["trait_name"]) }.values()) def __organise_diffs__(acc, item): if item["filepath"].name.endswith(".rejected"): -- cgit 1.4.1