~fabrixxm/activist

b4fcf2ef484041ea3e0831c96b7f43df226497f0 — fabrixxm a month ago 3dee6ea
Fix typing errors
2 files changed, 5 insertions(+), 5 deletions(-)

M activist/background.py
M activist/web.py
M activist/background.py => activist/background.py +1 -1
@@ 29,7 29,7 @@ class TaskType:
    created:datetime
    executed:Optional[datetime] = None
    every:Optional[float] = None
    error:Optional[dict[str,str]] = None
    error:Optional[list[dict]] = None

    _scheduled_at:Optional[datetime] = None


M activist/web.py => activist/web.py +4 -4
@@ 532,7 532,7 @@ def _private_search(searchq:str):
@app.route("/admin/tasks/<state>", methods=['GET', 'POST'])
@app.route("/admin/tasks/<state>/<taskid>", methods=['GET', 'POST'])
@login_required
def tasks(state:Optional[str] = None, taskid:Optional[str] = None):
def tasks(state:str = "", taskid:Optional[str] = None):
    data = {}
    if taskid is not None:
        f =  Background.taskstore(state) / taskid


@@ 546,7 546,7 @@ def tasks(state:Optional[str] = None, taskid:Optional[str] = None):
        tpl ="admin/task-modal.tpl.j2" if htmx else "admin/task.html.j2"
        return render_template(tpl, state=state, task=task)

    if state is not None:
    if state != "":
        if request.method == "POST":
            for f in Background.taskstore(state).glob("*"):
                f.unlink()


@@ 555,13 555,13 @@ def tasks(state:Optional[str] = None, taskid:Optional[str] = None):
            return redirect(url_for('tasks'))

        data[state] = [TaskType.from_file(f) for f in Background.taskstore(state).glob("*")]
        data[state].sort(key = lambda t: t._scheduled_at)
        data[state].sort(key = lambda t: t._scheduled_at if t._scheduled_at else 0)
        data[state].reverse()

    else:
        for state in ['pending', 'processing', 'failed', 'success']:
            data[state] = [TaskType.from_file(f) for f in Background.taskstore(state).glob("*")]
            data[state].sort(key = lambda t: t._scheduled_at)
            data[state].sort(key = lambda t: t._scheduled_at if t._scheduled_at else 0)
            data[state].reverse()