Ehance update change set

This commit is contained in:
wqy
2022-09-07 20:53:55 +08:00
parent bca5f61fff
commit fb28c3c610
3 changed files with 7 additions and 7 deletions

View File

@@ -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 })
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 })

View File

@@ -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

View File

@@ -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