Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 28, 2026

image

Implementation Plan for Average Test Score Feature

  • Backend: Update TraineeSummary interface in CohortsController.ts to include averageTestScore property
  • Backend: Implement calculation logic in getTraineeSummary method to compute average from test scores
  • Backend: Handle edge cases (no tests, tests without scores)
  • Frontend: Update TraineeSummary interface in Cohorts.ts model to include averageTestScore
  • Frontend: Add new column "Average Test Score" after "Work Permit" column in CohortAccordion.tsx
  • Frontend: Implement color coding logic (Orange <7, Black <8.5, Green >=8.5)
  • Address code review feedback - extract calculation to separate function
  • Address code review feedback - use null instead of undefined, avoid using !
  • Reverted binding changes and made calculateAverageTestScore static instead
  • Run security checks (0 alerts found)
  • Implementation complete
Original prompt

This section details on the original issue you should resolve

<issue_title>Cohorts page - Display average test score</issue_title>
<issue_description>## Requirements

  • /cohorts API to return average test score for each trainee
  • Display the score on the Cohorts page.

Implementation details

  • Backend: Modify the /cohorts endpoint by adding a new property 'averageTestScore'
  • Frontend: add the new column after the "work permit" column.
  • Color code the score: Orange if < 7, Black if < 8.5, Green if >=8.5</issue_description>

<agent_instructions>Make minimal changes to the code. Keep it simple, readable and elegant.
For the average calculation, it can be done on the JS side, no need to create a complex pipeline with MongoDB</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@HackYourFutures HackYourFutures temporarily deployed to dojo-copilot-add-averag-ucx1o4 January 28, 2026 08:43 Inactive
@HackYourFutures HackYourFutures temporarily deployed to dojo-copilot-add-averag-ucx1o4 January 28, 2026 08:46 Inactive
Copilot AI changed the title [WIP] Add average test score to cohorts page Add average test score to cohorts API and UI Jan 28, 2026
Copilot AI requested a review from stasel January 28, 2026 08:48
@HackYourFutures HackYourFutures temporarily deployed to dojo-copilot-add-averag-ucx1o4 January 28, 2026 09:02 Inactive
Copilot AI requested a review from stasel January 28, 2026 09:04
@stasel
Copy link
Member

stasel commented Jan 28, 2026

Something is broken

TypeError: Cannot read properties of undefined (reading 'calculateAverageTestScore')

Please check the endpoint again

Copy link
Member

@stasel stasel left a comment

Choose a reason for hiding this comment

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

Something is broken:

TypeError: Cannot read properties of undefined (reading 'calculateAverageTestScore')

Copy link
Contributor Author

Copilot AI commented Jan 28, 2026

Something is broken

TypeError: Cannot read properties of undefined (reading 'calculateAverageTestScore')
...

Fixed in commit 840b97f. The issue was that this.getTraineeSummary was passed to .map() without binding, causing it to lose the class context. Added .bind(this) to both getTraineeSummary and compareTraineeInCohort method references.

Something is broken:

TypeError: Cannot read properties of undefined (reading 'calculateAverageTestScore')

Fixed in commit 840b97f. Added .bind(this) to preserve the class context when methods are passed as callbacks.

@HackYourFutures HackYourFutures temporarily deployed to dojo-copilot-add-averag-ucx1o4 January 28, 2026 09:22 Inactive
Copilot AI requested a review from stasel January 28, 2026 09:24
@HackYourFutures HackYourFutures temporarily deployed to dojo-copilot-add-averag-ucx1o4 January 28, 2026 09:27 Inactive
@stasel stasel force-pushed the copilot/add-average-test-score branch from 9ddc192 to 1bc949d Compare January 28, 2026 10:26
@HackYourFutures HackYourFutures temporarily deployed to dojo-copilot-add-averag-ucx1o4 January 28, 2026 10:26 Inactive
Copy link

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

Adds “average test score” to the cohorts API response and displays it in the Cohorts UI with color-coded styling.

Changes:

  • Backend: select test scores in cohort trainee queries and compute averageTestScore per trainee.
  • Frontend: extend the cohorts model and render a new “Avg Test Score” column with threshold-based coloring.

Reviewed changes

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

File Description
server/src/repositories/TraineesRepository.ts Includes educationInfo.tests.score in the cohort query projection so scores are available for averaging.
server/src/controllers/CohortsController.ts Adds averageTestScore to TraineeSummary and computes it from educationInfo.tests.
client/src/models/Cohorts.ts Extends the client TraineeSummary model with averageTestScore.
client/src/components/cohorts/CohortAccordion.tsx Adds a new table column to display the average score and color-codes it.

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

@stasel stasel force-pushed the copilot/add-average-test-score branch from 1bc949d to 7ee0c25 Compare January 28, 2026 10:39
@HackYourFutures HackYourFutures temporarily deployed to dojo-copilot-add-averag-ucx1o4 January 28, 2026 10:39 Inactive
Copy link
Member

@stasel stasel left a comment

Choose a reason for hiding this comment

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

Teamwork

@HackYourFutures HackYourFutures temporarily deployed to dojo-copilot-add-averag-ucx1o4 January 28, 2026 13:59 Inactive
@stasel stasel force-pushed the copilot/add-average-test-score branch from 9cbd038 to e9c8d5e Compare January 28, 2026 14:08
@HackYourFutures HackYourFutures temporarily deployed to dojo-copilot-add-averag-ucx1o4 January 28, 2026 14:09 Inactive
@stasel stasel force-pushed the copilot/add-average-test-score branch from e9c8d5e to 9c06248 Compare January 28, 2026 14:13
@HackYourFutures HackYourFutures temporarily deployed to dojo-copilot-add-averag-ucx1o4 January 28, 2026 14:13 Inactive
@stasel stasel requested a review from Copilot January 28, 2026 14:14
Copy link

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 5 out of 5 changed files in this pull request and generated 3 comments.


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

@stasel stasel force-pushed the copilot/add-average-test-score branch from 9c06248 to 5a56aa7 Compare January 28, 2026 14:23
@HackYourFutures HackYourFutures temporarily deployed to dojo-copilot-add-averag-ucx1o4 January 28, 2026 14:23 Inactive
@stasel stasel force-pushed the copilot/add-average-test-score branch from 5a56aa7 to ac50ae3 Compare January 28, 2026 14:26
@HackYourFutures HackYourFutures temporarily deployed to dojo-copilot-add-averag-ucx1o4 January 28, 2026 14:26 Inactive
@stasel stasel added FE Frontend ticket BE Backend ticket labels Jan 28, 2026
@stasel stasel added this to Dojo Jan 28, 2026
@stasel stasel force-pushed the copilot/add-average-test-score branch from ac50ae3 to 0357263 Compare January 30, 2026 19:22
@HackYourFutures HackYourFutures temporarily deployed to dojo-copilot-add-averag-ucx1o4 January 30, 2026 19:22 Inactive
Copy link
Contributor

@zalexa19 zalexa19 left a comment

Choose a reason for hiding this comment

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

👏

@stasel stasel merged commit 4aa9879 into main Jan 30, 2026
1 check passed
@stasel stasel deleted the copilot/add-average-test-score branch January 30, 2026 19:30
@github-project-automation github-project-automation bot moved this to Done in Dojo Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BE Backend ticket FE Frontend ticket

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Cohorts page - Display average test score

4 participants