Skip to content

Conversation

@jkrizsan
Copy link
Contributor

@jkrizsan jkrizsan commented Sep 5, 2025

Brief description

As a clan member, I want to get points for my clan when I win a battle, so that my clan can rise in a battle leaderboard.

Change list

  • Add battlePoints to the clan schema and relevant DTOs
  • Extend the ClanRewarder service with a logic that can update the clans battlePoints similary how its works for the Players battlePoints
  • use the ClanRewarder from the ClanEventHandler and GameEventHandler
  • Add tests to cover the new code

Copy link
Member

@PlayJeri PlayJeri left a comment

Choose a reason for hiding this comment

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

Nice work.

Only thing I want to change is that the eventsHandler sends playerId to clan rewarder and not clanId. So the rewarder has to make another db query. Since the eventsHandler already has the clanId known it should send that to rewardForClanEvent and then remove the player query.

if (playerErrors) return [null, playerErrors];

const [, clanEventErrors] = await this.clanEventHandler.handleClanEvent(
player_id,
Copy link
Member

Choose a reason for hiding this comment

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

Change to clan_id

* @returns true if clan was rewarded successfully
*/
async rewardForClanEvent(
player_id: string,
Copy link
Member

Choose a reason for hiding this comment

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

Take in clan_id instead of player_id

await this.playerService.readOneById<PlayerDto>(player_id);
if (playerErrors) return [null, playerErrors];

if (!player.clan_id) {
Copy link
Member

Choose a reason for hiding this comment

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

If (!clan_id)

@PlayJeri PlayJeri dismissed their stale review September 5, 2025 10:52

My bad. The requested change isn't even possible.

Copy link
Member

@PlayJeri PlayJeri left a comment

Choose a reason for hiding this comment

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

Good work

@github-project-automation github-project-automation bot moved this from Backlog to Done in Altzone-Server Sep 5, 2025
@PlayJeri PlayJeri merged commit dc4ebf2 into dev Sep 5, 2025
4 checks passed
@PlayJeri PlayJeri deleted the feature/add-battle-points-for-clans-630 branch September 5, 2025 10:52
@jkrizsan
Copy link
Contributor Author

jkrizsan commented Sep 5, 2025

@PlayJeri no needed the player / clan id change?

@PlayJeri
Copy link
Member

PlayJeri commented Sep 5, 2025

@PlayJeri no needed the player / clan id change?

No need. I dont know what i was thinking earlier. My apologies 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature to add PR Pull request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants