Skip to content

Conversation

@MRita443
Copy link
Collaborator

@MRita443 MRita443 commented Sep 6, 2025

Adds missing Roles and Activities to the PerActivityRole seeder. Adds Roles to the Generation seeder, prioritizing giving more roles to the latest generation

Review checklist

  • Behavior is as expected
  • Clean, well structured code
  • Properly documents API changes in the corresponding controller test
  • Contains enough appropriate tests
  • Changes are reflected in the Wiki if necessary

@MRita443 MRita443 self-assigned this Sep 6, 2025
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

This PR completes the Role and Generation seeders by enhancing the seeding logic to properly associate roles with activities and generations. It updates the role names and permissions in the RoleSeeder, adds logic to assign roles to activities in the PerActivityRoleSeeder, and implements role distribution across generations with priority given to the latest generation.

Key Changes:

  • Modified role definitions with new names and updated permissions structure
  • Enhanced PerActivityRoleSeeder to randomly assign existing roles and activities to PerActivityRole entities
  • Added role assignment logic to GenerationSeeder that distributes roles across generations, giving extra roles to the latest generation

Reviewed Changes

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

Show a summary per file
File Description
RoleSeeder.kt Updates role names from "President", "Vice President" to "Board", "Member", "Coordinator" with adjusted permissions
PerActivityRoleSeeder.kt Adds dependency injection for repositories and logic to randomly assign roles and activities to PerActivityRole entities
GenerationSeeder.kt Implements role distribution logic across generations with priority for the latest generation
ApplicationSeeder.kt Comments out PerActivityRoleSeeder execution in the main application seeder
ActivitySeeder.kt Reorders seeder execution to run PerActivityRoleSeeder after other activity seeders

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions
Copy link

github-actions bot commented Sep 6, 2025

Check the documentation preview: https://68bc50d85692b99dd817f324--niaefeup-backend-docs.netlify.app

@github-actions
Copy link

github-actions bot commented Sep 6, 2025

Check the documentation preview: https://68bc50ffa1d6bda9fe3f095e--niaefeup-backend-docs.netlify.app

Comment on lines +50 to +64
// Shuffle roles and assign to generations
val shuffledRoles = allRoles.shuffled().toMutableList()
val updatedRoles = mutableListOf<Role>()

generations.forEachIndexed { index, generation ->
val count = rolesPerGen[index]
repeat(count) {
if (shuffledRoles.isNotEmpty()) {
val role = shuffledRoles.removeAt(0)
role.generation = generation
generation.roles.add(role)
updatedRoles.add(role) // Collect updated roles to save
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

To keep the data more realistic, I think each generation should get a "full set" of roles. What I mean my that is that each generation should have a set accounts in the board, coordinators and members.

Copy link
Member

@peucastro peucastro Sep 16, 2025

Choose a reason for hiding this comment

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

Not in the scope of this PR, but this seeder populates the perActivityRoles list with some permissions that are not related to the Acitivies model, such as EDIT_ACCOUNT and DELETE_ACCOUNT.

@github-actions
Copy link

github-actions bot commented Oct 6, 2025

Check the documentation preview: https://68e441fbc4314305ee69a96b--niaefeup-backend-docs.netlify.app

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.

3 participants