def change_state(id): task = Task.get_task_list(scheduler)[id] # print(task.id) if task.enabled: task.disable(scheduler) else: task.enable(scheduler) return redirect(url_for('meetings'))
def edit_task(id): task = Task.get_task_list(scheduler)[id] changes = dict.fromkeys(('name', 'link', 'triggers', 'enabled')) if not task: flash("That task doesn't exist", "info") elif request.method == "POST": #tree_print(request.form['data'], 0) data = json.loads(request.form['data']) #print(data) changes['name'] = request.form['meeting_name'] changes['link'] = request.form['meeting_link'] changes['triggers'] = [] for day in data['triggers']: for trigger in day[2]: hour, minute = trigger[2].split(":") changes['triggers'].append( Trigger(day_of_week=weeknums[day[0]], hour=int(hour), minute=int(minute))) task.configure(scheduler, **changes) #flash("Meeting Updated", "success") #tree_print(changes, 0) return redirect(url_for('meetings'))
def shift_task(id, direction): # print(id, direction) tasklist = Task.get_task_list(scheduler) tasklist.shift_task(id, int(direction)) return redirect(url_for('meetings'))
def disable_task(id): task = Task.get_task_list(scheduler)[id] task.disable(scheduler) flash(f"Disabled {task.name}", "success") return redirect(url_for('meetings'))
def delete_task(id): task = Task.get_task_list(scheduler)[id] task.delete(scheduler) # flash(f"Deleted {task.name}", "success") return redirect(url_for('meetings'))
def run_task(id): task = Task.get_task_list(scheduler)[id] scheduler.run_job(task.id, 'default') #task.get_task_list(scheduler).print_tasks() flash("Running Task", "info") return redirect(url_for('meetings'))
def meetings(): return render_template('Meetings.html', meetings=Task.get_task_list(scheduler), linkre=Task.browser_re)