Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/renderer/components/ProjectView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ const ProjectView: React.FC = () => {
return {
displayValue: manualEffort,
contributionValue: manualEffort || 0,
calculatedValue: 0,
hasAnyEstimation: isManualSet,
type: isManualSet ? 'manual' : 'none'
};
Expand All @@ -253,28 +254,29 @@ const ProjectView: React.FC = () => {
});

const contributionValue = isManualSet ? manualEffort : childContributionSum;
const displayValue = isManualSet ? Math.max(manualEffort, childContributionSum) : childContributionSum;
const displayValue = isManualSet ? manualEffort : childContributionSum;

if (!isManualSet) {
return {
displayValue,
contributionValue,
calculatedValue: childContributionSum,
hasAnyEstimation: childrenHaveEstimation,
type: displayValue > 0 ? 'calculated' : 'none'
};
}

// Manual effort is set. If no children have estimation, don't decorate.
if (!childrenHaveEstimation) {
return { displayValue, contributionValue, hasAnyEstimation: true, type: 'manual' };
// Manual effort is set.
if (!childrenHaveEstimation || childContributionSum === 0) {
return { displayValue, contributionValue, calculatedValue: childContributionSum, hasAnyEstimation: true, type: 'manual' };
}

if (manualEffort > childContributionSum) {
return { displayValue, contributionValue, hasAnyEstimation: true, type: 'manual-higher' };
return { displayValue, contributionValue, calculatedValue: childContributionSum, hasAnyEstimation: true, type: 'manual-higher' };
} else if (manualEffort === childContributionSum) {
return { displayValue, contributionValue, hasAnyEstimation: true, type: 'manual-equal' };
return { displayValue, contributionValue, calculatedValue: childContributionSum, hasAnyEstimation: true, type: 'manual-equal' };
} else {
return { displayValue, contributionValue, hasAnyEstimation: true, type: 'calculated-higher' };
return { displayValue, contributionValue, calculatedValue: childContributionSum, hasAnyEstimation: true, type: 'calculated-higher' };
}
};

Expand Down
17 changes: 6 additions & 11 deletions src/renderer/components/TaskView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ const TaskView: React.FC = () => {
if (res.hasEstimation) hasChildrenEstimation = true;
});

const effectiveValue = isManualSet ? Math.max(manualValue, childSum) : childSum;
const effectiveValue = isManualSet ? manualValue : childSum;

if (!isManualSet) {
return {
Expand All @@ -238,8 +238,8 @@ const TaskView: React.FC = () => {
};
}

// Manual effort is set. If no children have estimation, don't decorate.
if (!hasChildrenEstimation) {
// Manual effort is set.
if (!hasChildrenEstimation || childSum === 0) {
return { effectiveValue, manualValue, calculatedValue: childSum, hasChildrenEstimation: false, type: 'manual' };
}

Expand Down Expand Up @@ -373,16 +373,11 @@ const TaskView: React.FC = () => {
{effortInfo.type === 'calculated-higher' && <i className="fas fa-arrow-down me-1 text-info" title="Subtask sum is higher than manual estimate"></i>}
{effortInfo.effectiveValue} days
</span>
{effortInfo.manualValue !== null && effortInfo.calculatedValue !== null && (
{effortInfo.manualValue !== null && (effortInfo.calculatedValue || 0) > 0 && (
<div className="text-muted small ms-2">
{effortInfo.type === 'manual-higher' && (
<span>Subtasks: {effortInfo.calculatedValue}d</span>
)}
{effortInfo.type === 'calculated-higher' && (
<span>Manual: {effortInfo.manualValue}d</span>
)}
<span>Subtasks: {effortInfo.calculatedValue} days</span>
{effortInfo.type === 'manual-equal' && (
<span>Matching estimate</span>
<span className="ms-1 text-success small">(Matches)</span>
)}
</div>
)}
Expand Down
Loading