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 - volunteer completed hours #1177

Merged
merged 2 commits into from
Dec 16, 2024

Conversation

Dk-21
Copy link
Contributor

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

Volunteer Reporting Enhancements

This update introduces a new functionality to retrieve volunteers who logged hours meeting or exceeding their committed weekly hours, with added comparison functionality when a date range is provided.

Description

The changes in this PR include:

  • Adding the getVolunteersCompletedAssignedHours function in overviewReportHelper.js.
  • Updating the getVolunteerStatsData function in reportsController.js to include this new functionality.

These updates provide improved tracking of volunteer contributions and enable comparative analysis over different time periods.


Summary of Changes

Added Functionality

  1. Helper Function:

    • Created getVolunteersCompletedAssignedHours in overviewReportHelper.js.
    • Filters volunteers based on the following criteria:
      • Volunteers who logged hours meeting or exceeding their committed weekly hours.
      • Optionally calculates percentage growth when comparison date ranges are provided.
  2. API Endpoint Integration:

    • Updated the getVolunteerStatsData function in reportsController.js.
    • Ensures that the API response includes the new calculated results.

Related PRs


Main Changes Explained

File Updates:

1. overviewReportHelper.js

  • New Function:
    • getVolunteersCompletedAssignedHours: Computes volunteers who meet or exceed their committed weekly hours, and optionally calculates comparison percentages.

2. reportsController.js

  • Integration:
    • Modified the getVolunteerStatsData endpoint to call getVolunteersCompletedAssignedHours.
    • Added the computed results to the API response structure.

How to Test

1. Check into the Current Branch:

git checkout add-getVolunteersCompletedAssignedHours

2. Install Dependencies:

npm install

3. Run the Application:

npm run dev

4. Login Using Postman:

  • Endpoint:
    POST http://localhost:4500/api/login
  • Use Owner Credentials to Log In.
  • Authorization:
    • Copy the JWT token from the response.
    • Paste it into the Postman Headers Tab under Authorization.

5. Query the Endpoint:

  • API Call:
    GET http://localhost:4500/api/reports/volunteerstats?startDate=2024-05-26&endDate=2024-06 02&comparisonStartDate=2024-05-18&comparisonEndDate=2024-05-25
  • Expected Response:
    The API should return data with the count of volunteers who:
    • Logged hours meeting or exceeding their weekly commitment.
    • Include percentage growth if a comparison date range is provided.

Screenshots:

With Comparison Data
WithOut Comparison Data

Additional Notes

  • Ensure the startDate and endDate query parameters are provided in the API request.
  • Use valid owner credentials to authenticate API calls.
  • Verify the results include only the filtered volunteers as described and optional comparison growth percentages.

@Dk-21 Dk-21 changed the base branch from development to abi-volunteer-trends December 14, 2024 04:05
@Dk-21 Dk-21 changed the title New volunteer completed hours Denish - volunteer completed hours 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.

Works when comparison date parameters are and are not included in the request.

Great work, thank you!

Screenshot 2024-12-16 at 2 04 02 PM image

@strallia strallia force-pushed the new-volunteer-completed-hours branch from 462bb01 to c75f5b4 Compare December 16, 2024 22:21
@strallia strallia merged commit e0cce97 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