aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-07-26 11:23:40 +0300
committerFrederick Muriuki Muriithi2023-07-26 11:24:42 +0300
commit685a85ca335fe9c9b11f1ab86bb651ebfd993444 (patch)
treefaef67ba431b15716646519b8b31f8a2e8ba426a /wqflask
parentdf781ef99e747bd84e772ba9a40361e5d5b66809 (diff)
downloadgenenetwork2-685a85ca335fe9c9b11f1ab86bb651ebfd993444.tar.gz
bug: Fix bug where diffs were not computing correctly.
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/metadata_edits.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/wqflask/wqflask/metadata_edits.py b/wqflask/wqflask/metadata_edits.py
index b198c4ad..109ed65e 100644
--- a/wqflask/wqflask/metadata_edits.py
+++ b/wqflask/wqflask/metadata_edits.py
@@ -586,20 +586,20 @@ def show_history(dataset_id: str = "", name: str = ""):
author=author,
diff=Edit(
field,
- data_.get("old"),
- data_.get("new"),
- "\n".join(
- difflib.ndiff(
- [data_.get("old") or ""],
- [data_.get("new")],
- )
- ),
- ),
- timestamp=timestamp,
- )
- )
- if len(diff_data) > 0:
- diff_data_ = groupby(diff_data, lambda x: x.timestamp)
+ data_.get("old") or "",
+ data_.get("new") or "",
+ "\n".join(difflib.ndiff(
+ [str(data_.get("old")) or ""],
+ [str(data_.get("new")) or ""],
+ ))),
+ timestamp=timestamp))
+
+ if len(diff_data) > 0:
+ diff_data_ = groupby(
+ (diff for diff in diff_data if (
+ diff.diff.diff.startswith("-") or
+ diff.diff.diff.startswith("+"))),
+ lambda x: x.timestamp)
return render_template(
"edit_history.html",
diff=diff_data_,