Skip to content

Shreevaths taking over for Vamsidhar - Create Line Graph For Cost Breakdown by Expenditure 20 - #3906

Open
ReinaT5678 wants to merge 39 commits into
developmentfrom
reina-create-line-graph-for-cost-breakdown-by-expenditure-20
Open

ReinaT5678 wants to merge 39 commits into
developmentfrom
reina-create-line-graph-for-cost-breakdown-by-expenditure-20

Conversation

@ReinaT5678

@ReinaT5678 ReinaT5678 commented Aug 16, 2025 •

Copy link
Copy Markdown
Contributor

Description

image

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):

This frontend PR is related to the #1357 backend PR.
This is a redo of #3458
…

Main changes explained:

  • Added a new route to the page for the Expenditure Line Graph
  • "Cost Breakdown by Type of Expenditure" page shows a line graph generated by Chart.js showing projects related to plumbing, electrical, mechanical, and structural.
  • Component jsx file added as a simplified mini graph to fit in the weekly construction summary page.
    …

How to test:

  1. check into current branch
  2. do npm install and npm run start:local to run this PR locally
  3. Clear site data/cache
  4. log as admin user
  5. go to http://localhost:3000/bmdashboard/ExpenditureLineGraph
  6. Check if graph renders some lines (these lines were generated by fake data, you can play around with this in MongoDB)
  7. Check if the filter work
  8. check light/dark mode

Screenshots or videos of changes:

Screen.Recording.2025-08-15.at.10.19.06.PM.mov

@netlify

netlify Bot commented Aug 16, 2025 •

Copy link
Copy Markdown

✅ Deploy Preview for highestgoodnetwork-dev ready!

Name Link
🔨 Latest commit 1461943
🔍 Latest deploy log https://app.netlify.com/projects/highestgoodnetwork-dev/deploys/6ac7d3e9c68bbf0008d21f3c
😎 Deploy Preview https://deploy-preview-3906--highestgoodnetwork-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@ReinaT5678 ReinaT5678 added the High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible label Aug 16, 2025
@aseemdeshmukh

Copy link
Copy Markdown
Contributor

Referred the backend PR #[1357](OneCommunityGlobal/HGNRest#1357 backend PR)

  • 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

@Swetha-1306

Copy link
Copy Markdown

Tested the PR by checking out the backend PR#1357, I faced the error while fetching the data as shown below, the project drop down list is not working as well.
image

@JERRRRY

JERRRRY commented Aug 22, 2025

Copy link
Copy Markdown

Navigated to (bmdashboard/ExpenditureLineGraph) and shows 404 error. I can select the date range but the filter is not working.
Screenshot 2025-08-22 at 4 46 17 PM
Screenshot 2025-08-22 at 4 46 28 PM

@ReinaT5678 ReinaT5678 added Needs New Developer This is a PR that is partially developed but needs someone new to take it over and finish it. and removed High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible labels Aug 23, 2025
vishnu-ing
vishnu-ing previously approved these changes Aug 23, 2025

@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.

Code changes have been reviewed and tested the changes in both light and dark mode by adding date and category filters. Everything looks good.

image image image

aseemdeshmukh
aseemdeshmukh previously approved these changes Aug 24, 2025

@aseemdeshmukh aseemdeshmukh 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 perfect! (Referred BE PR 1357)

  • 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

PR3906_2
PR3906_1

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.)

@one-community one-community added the do not review Do not review or look at code without full context label Aug 26, 2025
@sonarqubecloud

Copy link
Copy Markdown

@kzou55 kzou55 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.

Hi Saurabh,

I ran and tested the PR using the current branch and the associated backend.

However, I was unable to verify the implementation.

Issues:

  • The line graph never appeared as I got the message "Loading Data".

  • The filters(filter by project, From, To) were not responsive. They were not clickable. Not sure if that's related to the above issue.

    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.

Getting page not found error. Please check this

Image

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

Copy link
Copy Markdown

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

@kzou55 kzou55 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.

Hi Shreevaths,

I ran and tested the PR locally alongside its associated backend.

Verified

  • Lines for Structural, Mechanical, Electrical, and Plumbing present and each a different color
  • Axes
    • X Axis the Month and Year
    • Y Axis the Costs
  • Filters can be done by Project and Dates(From and To)
  • Color coded legend present
  • Title of the Graph present being "Cost Breakdown by Type of Expenditure[project filter])"
  • Dark Mode looks good
Image Image Image

Issue/Clarification

  1. The PR description mentions that mock data is currently being used. However, based on my testing, it appears that the frontend initially retrieves the entire mock expenditure dataset from the backend, and the filter dropdown then filters the data on the frontend rather than making a new request to the backend for the filtered data. I observed that changing the filter did not result in any new network requests in the browser's Network tab.

Could you clarify if this is the intended behavior for the current implementation, or if the filter is expected to call the corresponding backend endpoint to retrieve the filtered data?

image

@shree-vaths

Copy link
Copy Markdown

Hello @kzou55 , please check this.

Clarification -

-Full dataset already required: date-range bounds (getDateRangeFromData) are computed across all records, so a full fetch happens on load regardless of filter state.
-No added client work: chart data is already reshaped in JS (buildGroupedData/buildLabels/buildDatasets); filtering is just one extra .filter() in that same pipeline.

  • Instant UX, no spinners: dropdown/date changes render immediately with no network round-trip or debounce needed.
  • Works offline after load: filtering keeps working even if the network drops mid-session.

@kzou55 kzou55 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.

Hi Shreevaths,

I ran and tested the PR locally again alongside its associated backend.

Verified

  • Lines for Structural, Mechanical, Electrical, and Plumbing present and each a different color

  • Axes

    • X Axis the Month and Year
    • Y Axis the Costs
  • Filters can be done by Project and Dates(From and To)

    • Start Date correctly cannot be after end date
  • Color coded legend present

  • Title of the Graph present being "Cost Breakdown by Type of Expenditure[project filter])"

  • Dark Mode looks good

    Recording.2026-09-09.173949.mp4

Clarification

I confirmed that the graph renders the expected data and that the project/date filters work as expected. However, I noticed that the current implementation filters the data on the frontend after fetching /api/bm/expenditure once, rather than fetching the cost data from the backend based on the selected project and date range as described in requirement #6 (API integration).

Could you clarify whether this requirement has changed, or if the expectation is still for the backend to handle the project/date filtering?
Image

Image

@kzou55 kzou55 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.

HI Shreevaths,

I ran and tested the PR locally again alongside its associated backend.

Verified

  • Lines for Structural, Mechanical, Electrical, and Plumbing present and each a different color

  • Axes

    • X Axis the Month and Year
    • Y Axis the Costs
  • Filters can be done by Project and Dates(From and To)

  • Start Date correctly cannot be after end date

  • Color coded legend present

    Image Image
  • Title of the Graph present being "Cost Breakdown by Type of Expenditure

  • Dark Mode looks good

    Image
  • Changes from previous review confirmed

    • Filters(Project, From, To) are now done by the backend rather than the frontend
    Image

Issues

  1. Calendar Date Picker has some inconsistent behavior in Light/Dark Mode. In dark mode, the dates(except for the future dates) are look clickable(no dull greyed out color to make it look like its an invalid click). However, in light mode, dates not in the current month are greyed out.
Image Image
  1. When using the date picker, the endpoint is called each time I navigate between months, even though I’m only browsing the calendar. Could we update this so the endpoint is called only after a date is actually selected? This would avoid unnecessary API requests while navigating through the months.
Recording.2026-10-03.214752.mp4

@sonarqubecloud

sonarqubecloud Bot commented Oct 8, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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.