app.services.user_points.assignment module

Points assignment (write path).

Resolves the strategy for a task, runs scoring (or takes the points directly) and delegates the atomic write to PointsPersistenceMixin._persist_points_wallet_and_transaction().

class app.services.user_points.assignment.PointsAssignmentMixin[source]

Bases: PointsPersistenceMixin

async assign_points_to_user_directly(gameId, externalTaskId, schema, api_key=None, *, oauth_user_id=None, is_admin=False, enforce_scope=False)[source]

Assign points to a user directly (non-simulated), using a predefined strategy.

Parameters:
  • gameId (UUID) – ID of the game.

  • externalTaskId (str) – External task identifier.

  • schema (PostAssignPointsToUser) – Input data schema.

  • api_key (str, optional) – API key used to register the operation.

  • oauth_user_id (str)

  • is_admin (bool)

  • enforce_scope (bool)

Returns:

AssignedPointsToExternalUserId – Information about the assigned points.

Return type:

AssignedPointsToExternalUserId

async assign_points_to_user(gameId, externalTaskId, schema, isSimulated=False, api_key=None, *, oauth_user_id=None, is_admin=False, enforce_scope=False)[source]

Assign points to a user.

Parameters:
  • gameId (UUID) – The game ID.

  • externalTaskId (str) – The external task ID.

  • schema (PostAssignPointsToUser) – The schema with the data to assign points.

  • api_key (str) – The API key used.

  • isSimulated (bool)

  • oauth_user_id (str)

  • is_admin (bool)

  • enforce_scope (bool)

Returns:

AssignedPointsToExternalUserId

The response with the points

assigned.

Return type:

AssignedPointsToExternalUserId