Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Denish - get volunteers over assigned time #1176

Merged
merged 2 commits into from
Dec 16, 2024

Conversation

Dk-21
Copy link
Contributor

@Dk-21 Dk-21 commented Dec 12, 2024

Description

This PR introduces a new functionality to retrieve volunteers who logged hours exceeding their committed weekly hours by 1 hour or more, while filtering out volunteers with committed hours less than 10. The changes include adding a new function getVolunteersOverAssignedTime in overviewReportHelper.js and integrating it into the API endpoint /api/reports/volunteerstats.

Summary of Changes

  • Added Functionality:
    • Created getVolunteersOverAssignedTime function in overviewReportHelper.js. This function filters volunteers based on the specified criteria and integrates seamlessly with other reporting helpers.
  • Updated API Controller:
    • Modified getVolunteerStatsData function in reportsController.js to call the new helper function and return its results in the API response.

Related PRs (if any)

This PR is based on Backend PR : Abi weekly summary reports page #1062.


Main Changes Explained

  • File Updates:
    • overviewReportHelper.js:
      • Added getVolunteersOverAssignedTime function to compute volunteers exceeding their committed hours by 1 or more.
    • reportsController.js:
      • Integrated the new helper function into the getVolunteerStatsData endpoint, ensuring it returns the appropriate data in the API response.

How to Test

  1. Check into the Current Branch:
    git checkout add-getVolunteersOverAssignedTime

2.Install Dependencies:

 npm install
  1. Run the Application:
npm run dev
  1. Login Using Postman:
    -Endpoint: POST http://localhost:4500/api/login
    -Use Owner Credentials to log in.
    -Copy the JWT token from the response and paste it into the Postman headers tab under Authorization.

  2. Query the Endpoint:
    API Call:

GET http://localhost:4500/api/reports/volunteerstats?startDate=2024-05-26&endDate=2024-06-02

Screenshot

Postman API Response

Notes

  • Ensure that the date range (startDate and endDate) provided in the API query reflects a valid period with active volunteers.
  • Verify that the JWT token used in Postman is from an Owner account to access restricted data.
  • Feel free to include screenshots or logs to confirm the data integrity during testing.

@strallia strallia changed the base branch from development to abi-volunteer-trends December 12, 2024 23:28
@Dk-21 Dk-21 changed the title Add get volunteers over assigned time Denish - get volunteers over assigned time Dec 14, 2024
Copy link
Contributor

@strallia strallia left a comment

Choose a reason for hiding this comment

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

Updated aggregation pipeline to use a more consistent date field and formatted the response. Everything else looks good!

Screenshot 2024-12-16 at 11 31 36 AM

@strallia strallia merged commit 1de6562 into abi-volunteer-trends Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants