Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dupe student user remixes #1128

Open
danhalson opened this issue Oct 28, 2024 · 5 comments · May be fixed by #1129
Open

Dupe student user remixes #1128

danhalson opened this issue Oct 28, 2024 · 5 comments · May be fixed by #1129

Comments

@danhalson
Copy link
Contributor

danhalson commented Oct 28, 2024

This is an issue in staging that @MFarringtonRPF observed, which led to a second remix being erroneously created for a user, and one of them not displaying user details on the Student Work page. There is a chance that old data might have a part in it.

The ids of Mel's projects where the issue was observed:

student_id (with dupe HTML projs): 5f3e56b7-9dc6-482a-a791-489ae4aa7f7d
school_id: d5f53eca-0b12-475a-9ef9-b4f5b4ddb250

This query shows possible further scenarios where this has been seen in prod:

SELECT 
    school_id, 
    user_id, 
    remixed_from_id, 
    project_type, 
    COUNT(*) AS remix_count,
    MIN(created_at) AS earliest_created_at,
    MAX(created_at) AS latest_created_at
FROM projects
WHERE school_id IS NOT NULL AND lesson_id IS NULL
GROUP BY school_id, user_id, remixed_from_id, project_type
HAVING COUNT(*) > 1;

Example problem records:

id, user_id, name, identifier, project_type, created_at, updated_at, remixed_from_id, locale, remix_origin, school_id, lesson_id, finished
96acbc0a-481e-4c6b-919e-c40db9c3a59a	9367a560-c3cb-470c-8c57-aac428e1c5a3	U1AQ5	recap-slept-enter	python	2024-10-17 08:15:58.430802	2024-10-17 08:15:58.430802	bf667646-5817-4fe4-a0d2-981b5d6a706f		https://editor.raspberrypi.org	9d2e4cc3-698a-46f5-a852-ad0fc257bd2c		
7ca2ad7c-2857-4636-8c5d-5b99501ff876	9367a560-c3cb-470c-8c57-aac428e1c5a3	U1AQ5	perky-iron-half	python	2024-10-17 08:24:01.284243	2024-10-17 08:24:01.284243	bf667646-5817-4fe4-a0d2-981b5d6a706f		https://editor.raspberrypi.org	9d2e4cc3-698a-46f5-a852-ad0fc257bd2c	

Logs:

First remix: https://logs.betterstack.com/team/54242/tail?s=314882&q=recap-slept-enter
Second remix: https://logs.betterstack.com/team/54242/tail?s=314882&q=perky-iron-half

@danhalson
Copy link
Contributor Author

@sra405 I've added all I know here, but if you could flesh it out with any further info, that would be great

@loiswells97 loiswells97 self-assigned this Oct 28, 2024
Copy link
Contributor

Branch issues/1128-Dupe_student_user_remixes created!

create-issue-branch bot added a commit that referenced this issue Oct 28, 2024
@create-issue-branch create-issue-branch bot linked a pull request Oct 28, 2024 that will close this issue
@MFarringtonRPF
Copy link

Staging - Plum School - Project name: Hello World: Basic HTML

Image

@loiswells97
Copy link
Contributor

So far: managed to fix displaying the student names if there are duplicate students, but still unsure why multiple remixes are being created

@loiswells97
Copy link
Contributor

loiswells97 commented Oct 29, 2024

Looks like the get request for the remix when the project is revisited isn't happening, it sends a get request for the original project instead. Then when the user clicks save, it successfully remixes the original project again, but does a get for the first remix and returns that.

e.g. https://telemetry.betterstack.com/team/54242/tail?s=314882&q=lyric-dent-math with remixes at
2024-10-24 13:51:10.32 and 2024-10-24 13:53:42.63

Could it be that there is a race condition between loading the user into state and requesting the project? If the project is being requested before the user is properly loaded, it may well assume that the user is not logged in and therefore load the original project rather than requesting the user's remix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants