Ejemplo n.º 1
0
def sort_tasks():
    '''
        App for filtering tasks
    '''
    form = SortTaskForm()
    res = []
    status = request.form.get('status')
    deadline = request.form.get('deadline')
    project_name = request.form.get('project_name')
    priority = request.form.get('priority')
    user_id = session['id']
    project = None
    if project_name:
        for pr in functions.get_all_projects(user_id):
            if pr[1] == project_name:
                project = pr[0]
                break
    tasks = functions.get_data_using_user_id(user_id)
    for task in tasks:
        if task[3] and 'completed' == status or 'uncompleted' == status and not task[
                3] or status == '':
            if (priority and int(priority) == task[5]) or not priority:
                if (deadline and deadline == task[4]) or not deadline:
                    if project and int(project) == task[2] or not project_name:
                        res.append(task)
    return render_template('view_tasks.html',
                           form=form,
                           tasks=res,
                           username=session['username'])
Ejemplo n.º 2
0
def tasks():
    '''
        App for task list
    '''
    form = SortTaskForm()
    tasks = functions.get_data_using_user_id(session['id'])
    return render_template('view_tasks.html',
                           form=form,
                           tasks=tasks,
                           username=session['username'])
Ejemplo n.º 3
0
def delete_task(id):
    '''
        App for deleting task
    '''
    functions.delete_task_using_id(id)
    tsk = functions.get_data_using_user_id(session['id'])
    tasks = []
    if tsk:
        for t in tsk:
            tasks.append(t)
    return redirect("/tasks/")
Ejemplo n.º 4
0
def task_status(tsk_id):
    '''
        App for change task status
    '''
    form = SortTaskForm()
    task = functions.get_data_using_id(tsk_id)
    functions.edit_task(task[1], task[2], (task[3] + 1) % 2, task[4], task[5],
                        task[0])
    tasks = functions.get_data_using_user_id(session['id'])
    return render_template('view_tasks.html',
                           form=form,
                           tasks=tasks,
                           username=session['username'],
                           id=tsk_id)
Ejemplo n.º 5
0
def delete_note(id):

    functions.delete_note_using_id(id)
    notes = functions.get_data_using_user_id(session['id'])
    tags = []
    if notes:
        for note in notes:
            tags_list = functions.get_tag_using_note_id(note[0])
            temp_list = []
            if tags_list:
                for tag in tags_list:
                    temp = functions.get_data_using_tag_id(tag)
                    if temp is not None:
                        temp_list.append(temp[0])
            tags.append(', '.join(temp_list))
    return render_template('profile.html', delete=True, tags=tags, username=session['username'], notes=notes)
Ejemplo n.º 6
0
def delete_note(id):
    '''
        App for viewing a specific note
    '''
    functions.delete_note_using_id(id)
    notes = functions.get_data_using_user_id(session['id'])
    tags = []
    if notes:
        for i in range(len(notes)):
            tags_list = functions.get_tag_using_note_id(notes[i][0])
            temp_list = []
            if tags_list:
                for j in range(len(tags_list)):
                    temp = functions.get_data_using_tag_id(tags_list[j])
                    if temp is not None:
                        temp_list.append(temp[0])
            tags.append(', '.join(temp_list))
    return render_template('profile.html', delete=True, tags=tags, username=session['username'], notes=notes)
Ejemplo n.º 7
0
def profile():
    if request.method == 'GET':
        notes = functions.get_data_using_user_id(session['id'])
        tags = []
        if notes:
            for note in notes:
                tags_list = functions.get_tag_using_note_id(note[0])
                temp_list = []
                if tags_list:
                    for tag in tags_list:
                        temp = functions.get_data_using_tag_id(tag)
                        if temp is not None:
                            temp_list.append(temp[0])
                tags.append(', '.join(temp_list))
        return render_template('profile.html',
                               username=session['username'],
                               notes=notes,
                               tags=tags)
Ejemplo n.º 8
0
def profile():
    '''
        App za korisnički profil, može se pristupiti samo nakon uspješne prijave
    '''
    if request.method == 'GET':
        notes = functions.get_data_using_user_id(session['id'])
        tags = []
        if notes:
            for note in notes:
                tags_list = functions.get_tag_using_note_id(note[0])
                temp_list = []
                if tags_list:
                    for tag in tags_list:
                        temp = functions.get_data_using_tag_id(tag)
                        if temp is not None:
                            temp_list.append(temp[0])
                tags.append(', '.join(temp_list))
        return render_template('profile.html',
                               username=session['username'],
                               notes=notes,
                               tags=tags)
Ejemplo n.º 9
0
def profile():
    '''
        App for user profile can only be accessed only after successful login
    '''
    if request.method == 'GET':
        notes = functions.get_data_using_user_id(session['id'])
        tags = []
        if notes:
            for i in range(len(notes)):
                tags_list = functions.get_tag_using_note_id(notes[i][0])
                temp_list = []
                if tags_list:
                    for j in range(len(tags_list)):
                        temp = functions.get_data_using_tag_id(tags_list[j])
                        if temp is not None:
                            temp_list.append(temp[0])
                tags.append(', '.join(temp_list))
        return render_template(
            'profile.html',
            username=session['username'],
            notes=notes,
            tags=tags
        )
Ejemplo n.º 10
0
def view_notes():
    '''
        App for user profile can only be accessed only after successful login
    '''
    if request.method == 'GET':
        notes = functions.get_data_using_user_id (session['id'])
        tags = []
        if notes:
            for note in notes:
                tags_list = functions.get_tag_using_note_id(note[0])
                temp_list = []
                if tags_list:
                    for tag in tags_list:
                        temp = functions.get_data_using_tag_id(tag)
                        if temp is not None:
                            temp_list.append(temp[0])
                tags.append(', '.join(temp_list))
        return render_template(
            'view_notes.html',
            username=session['username'],
            notes=notes,
            tags=tags
        )