Merge branch 'task-119-fix/tbl_zero_tasks' into 'development'

Task 119 fix/tbl zero tasks

See merge request !98
parents a7a0a978 b17e0019
......@@ -2,13 +2,13 @@ import express,{Router, Request, Response } from 'express';
import {Task} from '../models/Task';
import {myDataSource} from '../app-data-source';
import { DateTimeTask } from '../models/DateTimeTask';
import { authAuthorOrExecutorOfDateTimeTask, authAuthorOrExecutorOfTask } from '../helpers';
import { auth, authAuthorOrExecutorOfDateTimeTask, authAuthorOrExecutorOfTask } from '../helpers';
const router:Router = express.Router();
const dataSource = myDataSource;
/** make copy of task in calendar view */
router.post("/make-copy",authAuthorOrExecutorOfTask, async(req:Request, res:Response):Promise<Response>=>{
router.post("/make-copy",auth,authAuthorOrExecutorOfTask, async(req:Request, res:Response):Promise<Response>=>{
const {taskId, dateTimeDue, dateTimeStart, authorStatus, executorStatus, task} = req.body;
if(!task) return res.status(401).send({message:'task with possible user involved is not found'})
const newDateTimeTask = new DateTimeTask();
......@@ -20,7 +20,7 @@ router.post("/make-copy",authAuthorOrExecutorOfTask, async(req:Request, res:Resp
} )
/** change date time of copy of task in calendar view */
router.put("/change-copy/:dateTimeTaskId", authAuthorOrExecutorOfTask, async(req:Request, res: Response):Promise<Response>=>{
router.put("/change-copy/:dateTimeTaskId",auth, authAuthorOrExecutorOfTask, async(req:Request, res: Response):Promise<Response>=>{
const {dateTimeTaskId} = req.params
const {executorStatus,authorStatus, task, dateTimeStart, dateTimeDue, description, title, priority} = req.body
if(authorStatus){
......
......@@ -29,7 +29,7 @@ export default function EnhancedTable() {
const [order, setOrder] = useState("asc");
const [orderBy, setOrderBy] = useState("id");
const [page, setPage] = useState(0);
const [rowsPerPage, setRowsPerPage] = useState(5);
const [rowsPerPage, setRowsPerPage] = useState(25);
const [modal, setModal] = useState({
open: false,
task: null,
......@@ -41,8 +41,10 @@ export default function EnhancedTable() {
if (tasks && tasks?.length > 0) {
setRecievedTasks(tasks);
}
}, [ tasks?.length,addTaskForm, setAddTaskForm, dispatch]);
console.log('tasks ', tasks, 'projects ', projects)
}, [
tasks?.length,
addTaskForm, setAddTaskForm, dispatch]);
console.log('tasks ', tasks, 'projects ', projects,"recievedTasks ", recievedTasks )
......@@ -177,16 +179,18 @@ export default function EnhancedTable() {
if (projectIdListForTaskSelect.length>0) {
tasksFilteredByProject = tasks.filter(task=>projectIdListForTaskSelect.includes(task.project?.id))
}
console.log('tasksFilteredByProject ', tasksFilteredByProject)
setRecievedTasks(tasksFilteredByProject)
setFilterProjectTumbler(true)
}
if (
tasks &&
tasks?.length > 0 &&
recievedTasks &&
recievedTasks?.length > 0
) {
// if (
// tasks &&
// tasks?.length > 0
// &&
// recievedTasks &&
// recievedTasks?.length > 0
// ) {
return (
<Box sx={{ width: "fullwidth" }}>
<Paper sx={{ width: "100%", mb: 2 }}>
......@@ -212,7 +216,7 @@ export default function EnhancedTable() {
order={order}
orderBy={orderBy}
onRequestSort={handleRequestSort}
rowCount={tasks.length}
rowCount={recievedTasks.length}
/>
<TableBody>
{stableSort(recievedTasks, getComparator(order, orderBy))
......@@ -243,7 +247,7 @@ export default function EnhancedTable() {
<TablePagination
rowsPerPageOptions={[5, 10, 25]}
component="div"
count={tasks.length}
count={recievedTasks.length}
rowsPerPage={rowsPerPage}
page={page}
onPageChange={handleChangePage}
......@@ -260,7 +264,7 @@ export default function EnhancedTable() {
</Box>
);
}
}
// }
function descendingComparator(a, b, orderBy) {
if (b[orderBy] < a[orderBy]) {
......
......@@ -199,12 +199,12 @@ export default function UsersTasks() {
setFilterProjectTumbler(true)
}
if (
tasks &&
tasks?.length > 0 &&
recievedTasks &&
recievedTasks?.length > 0
) {
// if (
// tasks &&
// tasks?.length > 0 &&
// recievedTasks &&
// recievedTasks?.length > 0
// ) {
return (
<Box sx={{ width: "fullwidth" }}>
<Paper sx={{ width: "100%", mb: 2 }}>
......@@ -233,7 +233,7 @@ export default function UsersTasks() {
order={order}
orderBy={orderBy}
onRequestSort={handleRequestSort}
rowCount={tasks.length}
rowCount={recievedTasks.length}
/>
<TableBody>
......@@ -267,7 +267,7 @@ export default function UsersTasks() {
<TablePagination
rowsPerPageOptions={[5, 10, 25]}
component="div"
count={tasks.length}
count={recievedTasks.length}
rowsPerPage={rowsPerPage}
page={page}
onPageChange={handleChangePage}
......@@ -284,7 +284,7 @@ export default function UsersTasks() {
</Box>
);
}
}
// }
function descendingComparator(a, b, orderBy) {
......
Markdown is supported
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