remove steps table wip

This commit is contained in:
neo 2024-09-18 18:03:13 +02:00
parent d65e2a03ea
commit e7fc30d5f6
4 changed files with 25 additions and 26 deletions

View File

@ -83,18 +83,3 @@ tester_discharge_enable: yes
[autotest_leak]
enabled: false
pre_filling_time: 0
pre_filling_pressure: 0
filling_time: 10
settling_time: 10
settling_pressure_min_percent: 5
settling_pressure_max_percent: 5
test_pressure: 5000
test_time: 10
test_pressure_qpos: 10 #Q+ Upper test leak limit
test_pressure_qneg: 30 #Q- Lower test leak limit
test_pressure_tt_qpos: 1 # Q+ Upper test leak limit (tube-tube)
test_pressure_tt_qneg: 5 # Q- Lower test leak limit (tube-tube)
flush_time: 1
flush_pressure: 100
relay_config: 1

View File

@ -1,9 +1,11 @@
import json
from uuid import uuid4 as uuid
from peewee import BooleanField, TextField
from playhouse.sqlite_ext import JSONField
from .base_model import BaseModel
from ...helpers.step import Step
class Recipes(BaseModel):
@ -15,10 +17,17 @@ class Recipes(BaseModel):
archived = BooleanField(null=False, default=False)
def get_steps(self):
return self.spec
steps = []
for step_name, enabled in self.spec.items():
if enabled in (True, 1):
steps.append(Step(step_type=step_name,spec=self.spec["steps"][step_name]))
return steps
def get_steps_map(self):
return self.spec
steps = {}
for step_name, step_pk in self.spec.get("available_steps", {}).items():
steps[step_name] = Step(step_type=step_name,spec=self.spec["steps"][step_name])
return steps
@classmethod
def crud_delete(cls, deleted_rows):

View File

@ -129,11 +129,9 @@ class Recipe_Spec_And_Step_Editor(Editor):
def render(self, data, field_name=None, row_number=None, crud=None):
super().render(data, field_name=field_name, row_number=row_number, crud=crud)
steps = set(data.get("steps", set()))
for map in self.steps_map.values():
step = map.get("step", None)
if step is not None:
map["enable"].setChecked(step.name in steps and not map.get("hidden", False))
for step_name,step_def in self.steps_map.items():
if not step_def.get("hidden", False):
step_def["enable"].setChecked(data.get(step_name,{}) in (True,1,"x") )
self.render_steps()
def parse(self, action=None, row_number=None, crud=None):

View File

@ -235,7 +235,13 @@ class Test(Widget):
if self.autotest_period is not None:
self.autotest_timer.start(self.autotest_period)
reason = "boot"
if self.config["autotest_leak"]["enabled"] == "true":
self.autotest_request = reason
else:
self.autotest_request = False
else:
self.log.info(f"Autotest request ignored (reason: {reason!r}) --no-autotest flag detected")
if reason == "logout":
self.next(action="abort")
@ -244,7 +250,7 @@ class Test(Widget):
def next(self, action=None):
if self.step is not None:
self.log.info(f"cycle step: {model_to_dict(self.step)!r} action: {action!r} current index:{self.cycle_index}")
self.log.info(f"cycle step: {self.step.step_type!r} action: {action!r} current index:{self.cycle_index}")
else:
self.log.info(f"cycle step: {self.step!r} action: {action!r} current index:{self.cycle_index}")
@ -294,6 +300,7 @@ class Test(Widget):
self.autotesting = True
self.autotesting_reason = self.autotest_request
self.autotest_request = False
self.log.info(f"Autotest requested (reason: {self.autotesting_reason})")
if self.autotest_period is not None: # reset periodic autotest timer
self.time_timer.start(self.autotest_period)
self.require_discard_piece = False
@ -500,7 +507,7 @@ class Test(Widget):
w.reset()
# UPDATE RECIPE DISPLAY
if self.recipe is not None:
self.log.info(f"set recipe: {model_to_dict(self.recipe)!r} cycle steps: {[model_to_dict(s) for s in self.cycle_steps]}")
self.log.info(f"set recipe: {model_to_dict(self.recipe)!r} cycle steps: {[s.step_type for s in self.cycle_steps]}")
self.recipe_l.setText(self.recipe.name)
self.recipe_l.setStyleSheet("")
self.cycle_index = -1
@ -554,7 +561,7 @@ class Test(Widget):
if step_name not in self.data:
self.data[step_name] = {}
if data is not None:
data["step"] = model_to_dict(self.step)
data["step"] = self.step.spec
data["step"].pop("name", None)
# MAKE ARRAY ONLY IF MORE THAN ONE TEST OF SAME TYPE