Clean code
This commit is contained in:
@@ -42,7 +42,7 @@ class Mixing(object):
|
||||
return { 'type': self.type, 'tank': self.tank }
|
||||
|
||||
|
||||
def set_mixing_cmd(name: str, cs: ChangeSet) -> DbChangeSet:
|
||||
def _set_mixing(name: str, cs: ChangeSet) -> DbChangeSet:
|
||||
old = Mixing(get_mixing(name, cs.operations[0]['tank']))
|
||||
raw_new = get_mixing(name, cs.operations[0]['tank'])
|
||||
|
||||
@@ -67,10 +67,10 @@ def set_mixing(name: str, cs: ChangeSet) -> ChangeSet:
|
||||
return ChangeSet()
|
||||
if get_mixing(name, cs.operations[0]['tank']) == {}:
|
||||
return ChangeSet()
|
||||
return execute_command(name, set_mixing_cmd(name, cs))
|
||||
return execute_command(name, _set_mixing(name, cs))
|
||||
|
||||
|
||||
def add_mixing_cmd(name: str, cs: ChangeSet) -> DbChangeSet:
|
||||
def _add_mixing(name: str, cs: ChangeSet) -> DbChangeSet:
|
||||
new = Mixing(cs.operations[0])
|
||||
|
||||
redo_sql = f"insert into mixing (tank, model, value) values ({new.f_tank}, {new.f_model}, {new.f_value});"
|
||||
@@ -87,10 +87,10 @@ def add_mixing(name: str, cs: ChangeSet) -> ChangeSet:
|
||||
return ChangeSet()
|
||||
if get_mixing(name, cs.operations[0]['tank']) != {}:
|
||||
return ChangeSet()
|
||||
return execute_command(name, add_mixing_cmd(name, cs))
|
||||
return execute_command(name, _add_mixing(name, cs))
|
||||
|
||||
|
||||
def delete_mixing_cmd(name: str, cs: ChangeSet) -> DbChangeSet:
|
||||
def _delete_mixing(name: str, cs: ChangeSet) -> DbChangeSet:
|
||||
old = Mixing(get_mixing(name, cs.operations[0]['tank']))
|
||||
|
||||
redo_sql = f"delete from mixing where tank = {old.f_tank};"
|
||||
@@ -107,7 +107,7 @@ def delete_mixing(name: str, cs: ChangeSet) -> ChangeSet:
|
||||
return ChangeSet()
|
||||
if get_mixing(name, cs.operations[0]['tank']) == {}:
|
||||
return ChangeSet()
|
||||
return execute_command(name, delete_mixing_cmd(name, cs))
|
||||
return execute_command(name, _delete_mixing(name, cs))
|
||||
|
||||
|
||||
#--------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user