Actions
Feature improvement #15383
openFeature improvement #15504: Game infrastructure - new event structure refactor
Task service - new event structure refactor
Start date:
09/19/2024
Due date:
10/11/2024 (about 7 months late)
% Done:
90%
Estimated time:
custom category:
Backend
Pull Request:
Co-assignee:
Sprint:
240930 w_tasks (Sep 30 - Oct 07)
Description
Slide
- update the preprocesseing flow and structure of the KillEvent (GroupedKillEvent)
Task Service
- create a new handle event method for GroupedKillEvent as it has a different flow than the old handle event method (we might still need it so keep it as it is)
- ideally only make 1 database commit per GroupedKillEvent, making it more efficient and less buggy.
- optimize the update calls, calculate the points per GroupedKillEvent first, then commit them together in the least amount of updates as possible.
# Get associated users and their assigned tasks
users = get_associated_users()
assigned_tasks = get_assigned_tasks_from_index()
# Initialize an empty update dictionary
updates = {}
# Iterate over each assigned task
for task in assigned_tasks:
# Validate task data against the JSON schema
if validate_json_schema(assigned_tasks.task):
# Increment the task count in the update dictionary for the user
user_id = assigned_tasks.user_id
# Initialize user entry in the update dictionary if needed
if user_id not in updates:
updates[user_id] = {}
# Increment task count for this task in user's update dictionary
updates[user_id][assigned_task.id] = updates[user_id].get(assigned_task.id, 0) + 1
# Apply updates for each user
for user_id in updates:
# Iterate through each task in the user's list
for assigned_tasks in user_tasks:
assigned_task.progress += updates[user_id][task_id]
# Commit the updates for the user
commit_user_updates(user_id)
Actions