diff options
author | Frederick Muriuki Muriithi | 2023-07-26 11:23:40 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2023-07-26 11:24:42 +0300 |
commit | 685a85ca335fe9c9b11f1ab86bb651ebfd993444 (patch) | |
tree | faef67ba431b15716646519b8b31f8a2e8ba426a | |
parent | df781ef99e747bd84e772ba9a40361e5d5b66809 (diff) | |
download | genenetwork2-685a85ca335fe9c9b11f1ab86bb651ebfd993444.tar.gz |
bug: Fix bug where diffs were not computing correctly.
-rw-r--r-- | wqflask/wqflask/metadata_edits.py | 28 |
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_, |