feat(task-hierarchy): implement recursive task estimation and reset functionality
- Added SQL scripts to fix task hierarchy and reset parent task estimations to zero, ensuring accurate estimation calculations. - Introduced a migration for a recursive task estimation function that aggregates estimations from subtasks, enhancing task management. - Updated controllers to utilize recursive estimations for displaying task data, improving accuracy in task progress representation. - Implemented a new API route to reset parent task estimations, allowing for better task management and data integrity.
This commit is contained in:
@@ -82,14 +82,9 @@ const TaskDetailsForm = ({ taskFormViewModel = null, subTasks = [] }: TaskDetail
|
||||
const [form] = Form.useForm();
|
||||
const { project } = useAppSelector(state => state.projectReducer);
|
||||
|
||||
// Calculate sum of subtasks estimation
|
||||
const subTasksEstimation = subTasks.reduce(
|
||||
(acc, subTask) => ({
|
||||
hours: acc.hours + (subTask.total_hours || 0),
|
||||
minutes: acc.minutes + (subTask.total_minutes || 0)
|
||||
}),
|
||||
{ hours: 0, minutes: 0 }
|
||||
);
|
||||
// No need to calculate subtask estimation on frontend anymore
|
||||
// The backend now provides recursive estimation directly in the task data
|
||||
const subTasksEstimation: { hours: number; minutes: number } | undefined = undefined;
|
||||
|
||||
useEffect(() => {
|
||||
if (!taskFormViewModel) {
|
||||
|
||||
@@ -43,9 +43,11 @@ const FinanceDrawer = () => {
|
||||
const themeMode = useAppSelector((state) => state.themeReducer.mode);
|
||||
|
||||
const dispatch = useAppDispatch();
|
||||
const currency = useAppSelector(
|
||||
(state) => state.financeReducer.currency
|
||||
).toUpperCase();
|
||||
|
||||
// Get project currency from project finances, fallback to finance reducer currency
|
||||
const projectCurrency = useAppSelector((state) => state.projectFinances.project?.currency);
|
||||
const fallbackCurrency = useAppSelector((state) => state.financeReducer.currency);
|
||||
const currency = (projectCurrency || fallbackCurrency || 'USD').toUpperCase();
|
||||
|
||||
// function handle drawer close
|
||||
const handleClose = () => {
|
||||
|
||||
@@ -22,9 +22,10 @@ const ImportRatecardsDrawer: React.FC = () => {
|
||||
const isDrawerOpen = useAppSelector(
|
||||
(state) => state.financeReducer.isImportRatecardsDrawerOpen
|
||||
);
|
||||
const currency = useAppSelector(
|
||||
(state) => state.financeReducer.currency
|
||||
).toUpperCase();
|
||||
// Get project currency from project finances, fallback to finance reducer currency
|
||||
const projectCurrency = useAppSelector((state) => state.projectFinances.project?.currency);
|
||||
const fallbackCurrency = useAppSelector((state) => state.financeReducer.currency);
|
||||
const currency = (projectCurrency || fallbackCurrency || 'USD').toUpperCase();
|
||||
|
||||
const rolesRedux = useAppSelector((state) => state.projectFinanceRateCard.rateCardRoles) || [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user