From fb28c3c61049201a985b996e7c365ad29a04a737 Mon Sep 17 00:00:00 2001 From: wqy Date: Wed, 7 Sep 2022 20:53:55 +0800 Subject: [PATCH] Ehance update change set --- api/change_set.py | 4 ++-- api/s1_title.py | 2 +- api/s2_junctions.py | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/change_set.py b/api/change_set.py index 1e85ed9..571fe0d 100644 --- a/api/change_set.py +++ b/api/change_set.py @@ -10,5 +10,5 @@ class ChangeSet: def delete(self, type: str, id: str) -> None: self.deleted.append({ 'type': type, 'id': id }) - def update(self, type: str, id: str, property: str) -> None: - self.updated.append({ 'type': type, 'id': id, 'property': property }) \ No newline at end of file + def update(self, type: str, id: str, property_name: str, property_type: str, property_value: str) -> None: + self.updated.append({ 'type': type, 'id': id, 'property': property, 'property_type': property_type, 'property_value': property_value }) \ No newline at end of file diff --git a/api/s1_title.py b/api/s1_title.py index 3d0e3a3..4e34511 100644 --- a/api/s1_title.py +++ b/api/s1_title.py @@ -20,5 +20,5 @@ def set_title(name: str, value: str) -> ChangeSet: add_operation(name, redo, undo) change = ChangeSet() - change.update('title', 'null', 'value') + change.update('title', 'null', 'value', 'str', value) return change diff --git a/api/s2_junctions.py b/api/s2_junctions.py index 0c77405..6ba6a71 100644 --- a/api/s2_junctions.py +++ b/api/s2_junctions.py @@ -118,7 +118,7 @@ def set_junction_elevation(name: str, id: str, elevation: float) -> ChangeSet: add_operation(name, redo, undo) change = ChangeSet() - change.update('junction', id, 'elevation') + change.update('junction', id, 'elevation', 'float', str(elevation)) return change @@ -138,7 +138,7 @@ def set_junction_demand(name: str, id: str, demand: float) -> ChangeSet: add_operation(name, redo, undo) change = ChangeSet() - change.update('junction', id, 'demand') + change.update('junction', id, 'demand', 'float', str(demand)) return change @@ -162,7 +162,7 @@ def set_junction_pattern(name: str, id: str, pattern: str) -> ChangeSet: add_operation(name, redo, undo) change = ChangeSet() - change.update('junction', id, 'pattern') + change.update('junction', id, 'pattern', 'float', str(pattern)) return change @@ -184,5 +184,5 @@ def set_junction_coord(name: str, id: str, x: float, y: float) -> ChangeSet: add_operation(name, redo, undo) change = ChangeSet() - change.update('junction', id, 'coord') + change.update('junction', id, 'coord', 'point', str({'x': x, 'y': y})) return change