home
·
contact
·
privacy
projects
/
plomtask
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Slightly improve and re-organize Condition tests.
[plomtask]
/
plomtask
/
processes.py
diff --git
a/plomtask/processes.py
b/plomtask/processes.py
index d007d0f0ff14303e7668146323f0b2384a35cf55..bb1de3a4a3356415473bc652d650e202886eb01b 100644
(file)
--- a/
plomtask/processes.py
+++ b/
plomtask/processes.py
@@
-33,8
+33,13
@@
class Process(BaseModel[int], ConditionsRelations):
('process_disables', 'process', 'disables', 0),
('process_step_suppressions', 'process',
'suppressed_steps', 0)]
('process_disables', 'process', 'disables', 0),
('process_step_suppressions', 'process',
'suppressed_steps', 0)]
+ add_to_dict = ['explicit_steps']
to_search = ['title.newest', 'description.newest']
can_create_by_id = True
to_search = ['title.newest', 'description.newest']
can_create_by_id = True
+ sorters = {'steps': lambda p: len(p.explicit_steps),
+ 'owners': lambda p: p.n_owners,
+ 'effort': lambda p: p.effort.newest,
+ 'title': lambda p: p.title.newest}
def __init__(self, id_: int | None, calendarize: bool = False) -> None:
BaseModel.__init__(self, id_)
def __init__(self, id_: int | None, calendarize: bool = False) -> None:
BaseModel.__init__(self, id_)
@@
-47,14
+52,6
@@
class Process(BaseModel[int], ConditionsRelations):
self.calendarize = calendarize
self.n_owners: int | None = None # only set by from_table_row
self.calendarize = calendarize
self.n_owners: int | None = None # only set by from_table_row
- @property
- def as_dict(self) -> dict[str, object]:
- """Return self as (json.dumps-coompatible) dict."""
- d = super().as_dict
- d['explicit_steps'] = [s.as_dict for s in self.explicit_steps]
- d['suppressed_steps'] = [s.as_dict for s in self.suppressed_steps]
- return d
-
@classmethod
def from_table_row(cls, db_conn: DatabaseConnection,
row: Row | list[Any]) -> Process:
@classmethod
def from_table_row(cls, db_conn: DatabaseConnection,
row: Row | list[Any]) -> Process: