Skip to content

Shreevaths taking over for Vamsidhar - Create a Line Graph Chart for Cost Breakdown by Type of Expenditure - #1357

Open
ReinaT5678 wants to merge 31 commits into
developmentfrom
reina-create-line-graph-chart-for-cost-breakdown-by-expenditure-backend
Open

ReinaT5678 wants to merge 31 commits into
developmentfrom
reina-create-line-graph-chart-for-cost-breakdown-by-expenditure-backend

Conversation

@ReinaT5678

@ReinaT5678 ReinaT5678 commented May 1, 2025 •

Copy link
Copy Markdown
Contributor

Description

image

Backend for a frontend line graph chart that shows time in months (x-axis) and cost (y-axis) of projects. The chart can be filtered by projects and by date range.

Related PRS (if any):

To test this backend PR you need to checkout the #3458 frontend PR --> Redone with OneCommunityGlobal/HighestGoodNetworkApp#3906
…

Main changes explained:

  • Added a controller file to retrieve the sample expenditure data from the backend (id, date, category, cost)
  • Schema for expenditure data
  • Corresponding routes under '/expenditure'
    …

How to test:

  1. check into current branch
  2. do npm install and npm run start to run this PR locally
  3. Check out the frontend for more details

@ReinaT5678 ReinaT5678 added the Do Not Review Do not review or look at code without full context label May 1, 2025
@ReinaT5678 ReinaT5678 added High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible Do Not Review Do not review or look at code without full context and removed Do Not Review Do not review or look at code without full context High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible labels May 1, 2025
@Venk-rgb Venk-rgb self-assigned this Jun 27, 2025

@Venk-rgb Venk-rgb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the PR with the corresponding UI. Approving changes in the backend. I have added comments in the frontend PR.

Screen.Recording.2025-06-27.at.9.46.48.AM.mov

@ReinaT5678 ReinaT5678 removed the Do Not Review Do not review or look at code without full context label Jun 30, 2025

@shashank-madan shashank-madan left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected in light mode.

filters light_mode total_construction_summary In dark mode axis and legend labels are not visible. Added further comments in frontend pr. dark_mode

Comment thread src/startup/routes.js Outdated
@suparshwa31

suparshwa31 commented Jul 8, 2025 •

Copy link
Copy Markdown
Contributor

while I was testing of this PR I got an error fetching the data, the get request is failing
Screenshot 2025-07-08 at 16 31 21

@vamsidharpanithi vamsidharpanithi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked out and tested the backend along with the related frontend PR. The routes under /expenditure are defined, and the controller for retrieving expenditure data is present. However, the /ExpenditureLineGraph page on the frontend returns a 404 error, and there is a TypeError related to an undefined projectFilter state. This may indicate a mismatch between the expected backend response and the frontend integration. Please review the route accessibility and ensure the endpoint is correctly connected to the frontend component.

@adithya-6101 adithya-6101 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified the backend changes alongside the UI. The graph renders correctly, filters are working as expected, and both Light and Dark Mode are displaying properly and everything looks good. Approving this backend PR. I’ve shared my feedback separately on the frontend PR.

Screenshot 2025-07-15 144813 Screenshot 2025-07-15 144751

@Neeraj-Kondaveeti Neeraj-Kondaveeti left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the backend PR locally. The server runs without issues, but the /expenditure endpoint seems to return a 404 when accessed via the frontend in PR #3458. Happy to retest once it's addressed.

Screenshot 2025-07-15 at 4 10 32 PM

@shashankm9 shashankm9 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested this PR along with the frontend, Everything is working as expected.

PR.3458.mp4

@harshavarma29 harshavarma29 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested the related Frontend PR, and it's working as expected. However, I have left a few comments.

I noticed that an "undefined" category is being added next to the expenditures. Please refer to the screenshot below:

undefined-category

It seems the JSON property highlighted below leads to the "undefined" issue in the Frontend.

undefined-property

@kanishkagarwal6101 kanishkagarwal6101 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like few before me I am also getting the error in fetching data.
Screenshot 2025-08-04 at 1 10 57 PM

@aseemdeshmukh

Copy link
Copy Markdown

With reference to PR 3906, tested the backend:

  • After navigating to /bmdashboard/ExpenditureLineGraph), getting the error message:
    Error: Error fetching data: Request failed with status code 404 and I could not fetch the data
  • Even the 'Filter by project' drop down is not working to navigate through the list of projects
  • There was also a failure of GET request: GET https://api-staging.highestgood.com/api/bm/expenditure 404 (Not Found)
    PR3906+1357

@Swetha-1306

Copy link
Copy Markdown

Tested the related frontend PR #3906 by checking out this PR, got the following error while fetching the data: Error: Error fetching data: Request failed with status code 404

@vishnu-ing vishnu-ing left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the expenditure graph code changes and API in local and added comments in FE PR-3906.

@aseemdeshmukh aseemdeshmukh left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works perfect! (Referred FE PR 3906)

  • Tested in light and dark mode. Everything is clearly visible.
  • Filters work properly.
  • Getting the error when start date is greater than end date; which is expected
  • attached screenshots

NOTE (Whoever is getting Error 404 and the graph is not loading; check if the frontend API hitting the backend. Make sure your .env file has the same port as backend, and in the browser when loading the website check the API.)

PR3906_1
PR3906_2

@one-community one-community added Do Not Review Do not review or look at code without full context Needs New Developer This is a PR that is partially developed but needs someone new to take it over and finish it. labels Aug 26, 2025
@one-community one-community changed the title Vamsidhar taking over for Reina Create a Line Graph Chart for Cost Breakdown by Type of Expenditure Shreay P taking over for Vamsidhar - Create a Line Graph Chart for Cost Breakdown by Type of Expenditure Apr 26, 2026
@one-community one-community changed the title Shreay P taking over for Vamsidhar - Create a Line Graph Chart for Cost Breakdown by Type of Expenditure Shreya P taking over for Vamsidhar - Create a Line Graph Chart for Cost Breakdown by Type of Expenditure Apr 26, 2026
@sonarqubecloud

Copy link
Copy Markdown

@one-community one-community changed the title Shreya P taking over for Vamsidhar - Create a Line Graph Chart for Cost Breakdown by Type of Expenditure Saurabh taking over for Vamsidhar - Create a Line Graph Chart for Cost Breakdown by Type of Expenditure Jun 22, 2026
@one-community one-community added High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible and removed Do Not Review Do not review or look at code without full context Needs New Developer This is a PR that is partially developed but needs someone new to take it over and finish it. labels Jun 22, 2026

@kzou55 kzou55 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Saurabh,

I ran and tested the current branch locally alongside the associated frontend,

I could not verify the implementation as the line graph never loaded.

Image

@DeepighaJ DeepighaJ left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comment in frontend pr. The page not found is shown

Image

@one-community one-community changed the title Saurabh taking over for Vamsidhar - Create a Line Graph Chart for Cost Breakdown by Type of Expenditure XXXX taking over for Vamsidhar - Create a Line Graph Chart for Cost Breakdown by Type of Expenditure Jul 26, 2026
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
57.8% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@shree-vaths shree-vaths changed the title XXXX taking over for Vamsidhar - Create a Line Graph Chart for Cost Breakdown by Type of Expenditure Shreevaths taking over for Vamsidhar - Create a Line Graph Chart for Cost Breakdown by Type of Expenditure Aug 1, 2026

@sawantgayatri19 sawantgayatri19 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello everyone,

I have consolidated the feedback and tested the current implementation. Below are the key bugs and items that need to be addressed before this can be merged:

1.API 404 Error / Data Fetching Failures:
Multiple reviewers (aseemdeshmukh, Swetha-1306, kanishkagarwal6101, etc.) are consistently encountering Request failed with status code 404 when hitting the /api/bm/expenditure endpoint from the frontend. Please double-check the route registration and endpoint wiring to ensure the backend seamlessly connects with the frontend PR.
2. Dark Mode Label Visibility:
As noted by shashank-madan, axis and legend labels are not visible in dark mode and need proper styling adjustments.
3. "Undefined" Category Bug:
harshavarma29 pointed out that an "undefined" category appears next to expenditures due to a mismatch or missing property in the backend JSON response. Please sanitize/verify the payload fields.
4. SonarCloud Quality Gate (Code Coverage):
The current SonarCloud check is failing because the new code coverage is at 57.8% (falling short of the required 80%threshold). Please add unit tests to cover the new code paths and resolve the quality gate failures.

Looking forward to the updates so we can get this merged!

@kzou55 kzou55 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Shreevaths,

I ran and tested the PR locally alongside its associated frontend. See the frontend PR for its review.

Issue/Clarification

  • Could you clarify if the PR description outdated? I tried running the endpoint api/projects/646be02cb56e486c046486b6/cost-breakdown but it does not appear to work.

    Image

@kzou55 kzou55 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Shreevaths,

Clarification

Could you confirm whether the backend API requirements in the task description are still current? The specification calls for GET /api/projects/:id/cost-breakdown with two date query parameters, but the current implementation uses GET /api/bm/expenditure and returns all expenditure records, with the frontend handling the filtering. Is the current endpoint/architecture intentional, or should it be updated to match the API requirements in the task description?

@kzou55 kzou55 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Shreevaths,

I ran and tested the PR locally again alongside its associated frontend

Verified

  • api/projects/all/cost-breakdown
    Image

  • Getting a specific project cost breakdown: api/projects/5a849085592ca46b43db272a/cost-breakdown
    Image

  • Filtering by Date

    • Start Date
    Image
    • Both
    Image

@sonarqubecloud

sonarqubecloud Bot commented Oct 8, 2026

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.