Commit 75409b0e authored by ras19's avatar ras19
Browse files

Display project name and link the project landing page on project task preview on dashboard [RS]

parent 15281ae6
Pipeline #203757 passed with stage
in 1 minute and 14 seconds
......@@ -4,7 +4,7 @@ from flask import Blueprint, request, jsonify
from backend.database_config.database import DB
from backend.models.task_model import AssignedTask
from backend.models.task_model import Task
import json
from backend.models.project_model import Project
assigned_task = Blueprint('assigned_task', __name__)
......@@ -23,6 +23,8 @@ def get_all_assignments():
def get_tasks_for_user(username):
entries = AssignedTask.query.filter_by(username=username)
task_list = [{"description": task.description,
"project_id": task.project_id,
"project_name": Project.query.get(task.project_id).name,
"priority": task.priority,
"due_date": task.due_date} for task in (Task.query.get(x.task_id) for x in entries)]
return jsonify(task_list)
......
import useFetch from './useFetch'
import { useState } from "react";
import { Link } from 'react-router-dom'
const MyProjectTasks = ({ tasks, title }) => {
return (
......@@ -9,9 +8,12 @@ const MyProjectTasks = ({ tasks, title }) => {
<div className="my-project-tasks">
{tasks.map((task) => (
<div className="task-preview" key={task.id}>
<h2>{task.description}</h2>
<h2>{task.project_name}: {task.description}</h2>
<h3><strong>Priority level:</strong> {task.priority}</h3>
<h3><strong>To be done by:</strong> {task.due_date}</h3>
<Link to={`/projects/${task.project_id}`}>
<h4>Go to project landing page</h4>
</Link>
</div>
))}
</div>
......
......@@ -81,7 +81,7 @@ const PersonalToDo = ({ todos, title }) => {
<div className="todo-preview" key={todo.id}>
<h2>{todo.todo_desc}</h2>
<h3>Priority level: {todo.priority}</h3>
<h3>To be done by:{todo.due_date}</h3>
<h3>To be done by: {todo.due_date}</h3>
<button onClick={handleRemove(todo.id)}>Complete</button>
</div>
))}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment