start = self._params.get_str_or_fail('start', '')
end = self._params.get_str_or_fail('end', '')
end = end if end != '' else date_in_n_days(366)
+ #
days, start, end = Day.by_date_range_with_limits(self._conn,
(start, end), 'id')
days = Day.with_filled_gaps(days, start, end)
def do_GET_day(self) -> dict[str, object]:
"""Show single Day of ?date=."""
date = self._params.get_str_or_fail('date', date_in_n_days(0))
+ make_type = self._params.get_str_or_fail('make_type', 'full')
+ #
day = Day.by_id_or_create(self._conn, date)
- make_type = self._params.get_str_or_fail('make_type', '')
conditions_present = []
enablers_for = {}
disablers_for = {}
def do_GET_todos(self) -> dict[str, object]:
"""Show Todos from ?start= to ?end=, of ?process=, ?comment= pattern"""
- sort_by = self._params.get_str_or_fail('sort_by', '')
+ sort_by = self._params.get_str_or_fail('sort_by', 'title')
start = self._params.get_str_or_fail('start', '')
end = self._params.get_str_or_fail('end', '')
process_id = self._params.get_int_or_none('process_id')
comment_pattern = self._params.get_str_or_fail('comment_pattern', '')
+ #
todos = []
ret = Todo.by_date_range_with_limits(self._conn, (start, end))
todos_by_date_range, start, end = ret
def do_GET_conditions(self) -> dict[str, object]:
"""Show all Conditions."""
pattern = self._params.get_str_or_fail('pattern', '')
- sort_by = self._params.get_str_or_fail('sort_by', '')
+ sort_by = self._params.get_str_or_fail('sort_by', 'title')
+ #
conditions = Condition.matching(self._conn, pattern)
sort_by = Condition.sort_by(conditions, sort_by)
return {'conditions': conditions,
owner_ids = self._params.get_all_int('step_to')
owned_ids = self._params.get_all_int('has_step')
title_64 = self._params.get_str('title_b64')
+ #
if title_64:
try:
title = b64decode(title_64.encode()).decode()
def do_GET_processes(self) -> dict[str, object]:
"""Show all Processes."""
pattern = self._params.get_str_or_fail('pattern', '')
- sort_by = self._params.get_str_or_fail('sort_by', '')
+ sort_by = self._params.get_str_or_fail('sort_by', 'title')
+ #
processes = Process.matching(self._conn, pattern)
sort_by = Process.sort_by(processes, sort_by)
return {'processes': processes, 'sort_by': sort_by, 'pattern': pattern}
comments = self._form.get_all_str('comment')
efforts = self._form.get_all_floats_or_nones('effort')
done_todos = self._form.get_all_int('done')
+ #
for _ in [id_ for id_ in done_todos if id_ not in old_todos]:
raise BadFormatException('"done" field refers to unknown Todo')
is_done = [t_id in done_todos for t_id in old_todos]
cond_rels = [self._form.get_all_int(name) for name in
['conditions', 'blockers', 'enables', 'disables']]
effort_or_not = self._form.get_str('effort')
+ #
if effort_or_not is not None:
if effort_or_not == '':
to_update['effort'] = None
for step_id in kept_steps:
name = f'new_step_to_{step_id}'
new_steps_to[step_id] = self._form.get_all_int(name)
+ #
for k, v in versioned.items():
getattr(process, k).set(v)
process.set_condition_relations(self._conn, *cond_rels)
title = self._form.get_str_or_fail('title')
description = self._form.get_str_or_fail('description')
is_active = self._form.get_bool_or_none('is_active')
+ #
if is_active is not None:
condition.is_active = is_active
condition.title.set(title)