Project

General

Profile

Actions

Feature improvement #15383

open

Feature improvement #15504: Game infrastructure - new event structure refactor

Task service - new event structure refactor

Added by Peter Mačuga 8 months ago. Updated 7 months ago.

Status:
Code Review
Priority:
Normal
Target version:
-
Start date:
09/19/2024
Due date:
10/11/2024 (about 7 months late)
% Done:

90%

Estimated time:
custom category:
Backend
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 #1

Updated by Kennedy Bacelar 8 months ago

  • % Done changed from 0 to 50

Finished implementation on slide repo:
https://github.com/QORPO-WORLD/slide/pull/27

Actions #2

Updated by Peter Mačuga 7 months ago

  • Description updated (diff)
Actions #3

Updated by Peter Mačuga 7 months ago

  • Description updated (diff)
Actions #4

Updated by Peter Mačuga 7 months ago

  • % Done changed from 50 to 30
Actions #5

Updated by Peter Mačuga 7 months ago

  • Sprint set to 240916 w_tasks (Sep 16 - Sep 23)
Actions #6

Updated by Peter Mačuga 7 months ago

  • Subtask #15504 added
Actions #7

Updated by Peter Mačuga 7 months ago

  • Subtask deleted (#15504)
Actions #8

Updated by Peter Mačuga 7 months ago

  • Subtask #15504 added
Actions #9

Updated by Peter Mačuga 7 months ago

  • Subtask deleted (#15504)
Actions #10

Updated by Peter Mačuga 7 months ago

  • Parent task set to #15504
Actions #11

Updated by Peter Mačuga 7 months ago

  • Subject changed from Grouped Events refactor to Task service - new event structure refactor
Actions #12

Updated by Serhii Bilovodov 7 months ago

  • % Done changed from 0 to 30
Actions #13

Updated by Serhii Bilovodov 7 months ago

  • Sprint changed from 240916 w_tasks (Sep 16 - Sep 23) to 240923 w_tasks (Sep 23 - Sep 30)
Actions #14

Updated by Kennedy Bacelar 7 months ago

  • Status changed from In Progress to Code Review
  • % Done changed from 30 to 90

PR submitted for approval:
https://github.com/QORPO-WORLD/qorpo-task-service/pull/19

Waiting for review.

Actions #15

Updated by Serhii Bilovodov 7 months ago

  • Sprint changed from 240923 w_tasks (Sep 23 - Sep 30) to 240930 w_tasks (Sep 30 - Oct 07)
Actions

Also available in: Atom PDF