Skip to content

Labor attendance report 1626#1684

Open
Arohasina wants to merge 22 commits intodevelopmentfrom
Labor_Attendance_report_1626
Open

Labor attendance report 1626#1684
Arohasina wants to merge 22 commits intodevelopmentfrom
Labor_Attendance_report_1626

Conversation

@Arohasina
Copy link
Copy Markdown
Contributor

@Arohasina Arohasina commented Feb 25, 2026

Issue Description

Fixes #1626

  • We should have a sheet in the Reports downloads that shows labor attendance for the academic year. The report should have a list of labor students and the number of labor meetings that they attended for each term in the academic year.

Changes

  • Implemented laborAttendanceByTerm(term) function to query labor students and count their meeting attendance by term
  • Added "Labor Attendance By Term" sheet to the spreadsheet generation in createSpreadsheet() , there are two sheets: one for Fall term and one for Spring term
  • added the test function test_laborAttendanceByTerm in test_spreadsheet.py

This is how the spreadsheet looks like:
image

Testing

  • run database/reset_database.sh test and then tests/run_tests.sh or if you want to test the laborAttendanceByTerm function specifically, you can run pytest tests/code/test_spreadsheet.py::test_laborAttendanceByTerm -v
  • after it passed, run database/reset_database.sh from-backup and then flask run
  • Once you are in the Celts app, go to event list choose Fall 2024, and then choose a couple of events there, such as these events
image
  • And for each, click on the event, turn on the toggle "This event is for labor only" , and then click "save"
image

-And then do the same for Spring 2025.

  • Then go to admin --> report --> select academic year 2024 - 2025 --> download the spreadsheet, open it, and you should see a sheet called "Labor Attendance By Term" with the reporting, one for Fall and one for Spring term.

Copilot AI review requested due to automatic review settings February 25, 2026 22:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request implements a labor attendance report feature that tracks labor student participation in labor-only meetings across terms within an academic year. The implementation adds a new sheet to the downloadable reports spreadsheet showing each labor student's meeting attendance count per term.

Changes:

  • Added laborAttendanceByTerm() function to query and aggregate labor meeting attendance by student and term
  • Integrated the new "Labor Attendance By Term" sheet into the spreadsheet generation workflow
  • Added comprehensive integration test coverage for the new functionality

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
app/logic/volunteerSpreadsheet.py Implements laborAttendanceByTerm function (lines 228-249) to query labor students and count their meeting attendance, and integrates it into createSpreadsheet (line 298)
tests/code/test_spreadsheet.py Adds test_laborAttendanceByTerm integration test (lines 686-724) covering empty results and attendance counting scenarios

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 26, 2026 20:27
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Arohasina and others added 2 commits February 26, 2026 15:28
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings February 26, 2026 20:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 26, 2026 20:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings March 24, 2026 19:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 10 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Arohasina and others added 2 commits March 24, 2026 15:46
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 25, 2026 20:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings March 26, 2026 20:04
@github-actions
Copy link
Copy Markdown

View Code Coverage

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

fn.CONCAT(User.firstName, ' ', User.lastName).alias('fullName'),
User.bnumber,
fn.CONCAT(User.username, '@berea.edu').alias('email'),
fn.COUNT(EventParticipant.event_id).alias('meetingsAttended')
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

nonLaborQuery counts EventParticipant.event_id without DISTINCT, while laborQuery counts distinct Event.id. Since EventParticipant has no uniqueness constraint on (user,event), duplicate participant rows would inflate the meeting count for non-labor attendees. Use a distinct count here as well (e.g., count distinct event id) so "Meetings Attended" consistently reflects unique meetings.

Suggested change
fn.COUNT(EventParticipant.event_id).alias('meetingsAttended')
fn.COUNT(fn.DISTINCT(EventParticipant.event_id)).alias('meetingsAttended')

Copilot uses AI. Check for mistakes.
Comment on lines +256 to +260
.where(
(CeltsLabor.term == term)
)
.group_by(CeltsLabor.user)
)
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

This query selects non-aggregated columns (full name, bnumber, email) but only groups by CeltsLabor.user. This relies on MySQL's non-standard GROUP BY behavior and will break if ONLY_FULL_GROUP_BY is enabled, and it also reduces portability/clarity. Include the non-aggregated selected columns (or the underlying User fields) in the GROUP BY to make the aggregation deterministic and SQL-standard.

Copilot uses AI. Check for mistakes.
(CeltsLabor.term == term)
)
.where(CeltsLabor.user.is_null())
.group_by(EventParticipant.user)
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

This query selects non-aggregated columns (full name, bnumber, email) but only groups by EventParticipant.user. As written, it depends on MySQL's permissive GROUP BY behavior and can fail under ONLY_FULL_GROUP_BY. Group by the non-aggregated selected columns (or the underlying User fields) so the aggregation is deterministic and compatible with stricter SQL modes.

Suggested change
.group_by(EventParticipant.user)
.group_by(
User.firstName,
User.lastName,
User.bnumber,
User.username,
)

Copilot uses AI. Check for mistakes.
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.

Add Labor Attendance report

4 participants