Devlog 10
Hi, everybody!
In my previous devlog, I mentioned that this would be my last devlog. But unfortunately, while integrating the features, I faced some unexpected issues related to match results, logic, and friendly match integration.
1. Working on the UI
Most of my time went into completing the pending UI work. After that, I started fixing logical errors related to friendly matches and result uploading.
2. The Friendly Match Integration Problem
Most of my existing match logic was designed for tournaments, which have an event ID. But friendly matches don’t belong to any tournament, so they don’t have an event ID.
To solve this, I made the event ID optional in the match room function.
def match_room(request, match_room_id, event_id=None):
I also created separate URL patterns for tournament and friendly matches and used conditional logic to handle them differently.
if not match.friendly_match_room:
# Tournament logic
pass
else:
# Friendly match logic
pass
3. Fixing the Match Result Processing System
My website uses JSON to pass match and tournament details. Friendly matches caused errors because they don’t have tournament information.
So, I added conditional logic to set tournament-related values to None for friendly matches.
if not match.friendly_match_room:
tournament_name = match.tournament.name
tournament_id = match.tournament.id
winner_team = match.winner_team
else:
tournament_name = None
tournament_id = None
winner_team = None
I then passed these variables into the JSON response.
4. Implementing the Loot Transfer Logic
I also worked on the loot system for friendly matches. Loot refers to the coins players contribute to the match.
For example, if four players contribute 100 coins each, the total loot pool becomes 400 coins, which the winner receives.
I implemented this logic in the views so that loot is transferred only after a valid match result is determined. If a match is cancelled or ends without a valid result, no coins are transferred.
So these are things I have done in this time period and so next will be last devlog I hope