Gayatri -Fix taskHours always returning 0 in getTaskAndProjectStats - #2322
Open
sawantgayatri19 wants to merge 1 commit into
Open
Gayatri -Fix taskHours always returning 0 in getTaskAndProjectStats#2322sawantgayatri19 wants to merge 1 commit into
sawantgayatri19 wants to merge 1 commit into
Conversation
|
DeepighaJ
requested changes
Sep 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Description
Fixed a bug on the Total Org Summary dashboard where the "Hours Completed" chart's Tasks bar always showed 0 hours, regardless of the selected date range, while Project hours displayed correctly. The related "Task Completed" widget (Assigned/Completed counts) on the same page was affected by the same underlying issue.
The root cause was in
getTaskHoursinsideoverviewReportHelper.js. The MongoDB aggregation filtered time entries using:This incorrectly excluded entries with
entryType: 'person'. However,'person'is a legitimate entryType for individual task-level time entries in this app — confirmed by the same categorization pattern already used elsewhere in this same file (line ~1043) and in the frontend (src/actions/timeEntries.js), which both treat'default'and'person'as equivalent task-level entry types. Since most real task time entries are logged withentryType: 'person', the filter was silently excluding nearly all of them, causingtaskHours.countto always return 0.Fixes ticket #1335 (P1/Total Org Summary: "Hours Completed" chart shows 0 hours for Tasks and very low hours for Project).
Related PRs (if any):
None.
Main changes explained:
src/helpers/overviewReportHelper.js: changed thegetTaskHoursaggregation's$matchfilter fromentryType: { $nin: ['person', 'team', 'project'] }toentryType: { $in: ['default', 'person', null] }, matching the categorization pattern already used elsewhere in this file for task/individual-level time entries.How to test:
npm installandnpm run devto run the backend locallyHighestGoodNetworkApp) and log in as admin/totalorgsummary)Screenshots or videos of changes:
Note:
Full backend test suite: 146/147 suites pass. The one failing suite (
reasonSchedulingController.test.js) fails identically with and without this change — confirmed viagit stashtesting — due to a pre-existing local MongoDB connection timeout in the dev environment, unrelated to this fix.overviewReportHelper.spec.js(7/7 tests) passes.