EmotionCognitionLab / pvs

1 stars 0 forks source link

Missing lumos user results in error setting stage 2 status #327

Closed noah10 closed 1 year ago

noah10 commented 1 year ago

We have separated the list of lumosity users into a prod list and a dev list, but the report contains all of the users. This means that when we try to process dev users in prod (or vice versa) we get errors about missing users. The real problem, though, is when we have a missing user who has completed stage two we still try to set his stage 2 status, resulting in these errors:

ERROR   ValidationException: The provided key element does not match the schema
ERROR   Max tries exceeded. Dynamo op: update. Parameters: 
{
    "TableName": "pvs-prod-users",
    "Key": {
        "userId": null
    },
    "UpdateExpression": "set #stage2Completed = :stage2Completed, #stage2CompletedOn = :stage2CompletedOn",
    "ExpressionAttributeNames": {
        "#stage2Completed": "stage2Completed",
        "#stage2CompletedOn": "stage2CompletedOn"
    },
    "ExpressionAttributeValues": {
        ":stage2Completed": true,
        ":stage2CompletedOn": "20230107"
    }
}

We should obviously not try to save any data about any lumosity users who lack a corresponding user id.