Anonymous_user_id, notes and Tutor

While testing our migration from Native (Koa) to Tutor (Nutmeg), I found a new issue that I am currently trying to resolve.

The problem seems to be with the tutor-notes plugin and the student_anonymoususerid table.

When I recovered the data from the notes database in Native, the values of the field user_id in the v1_note table is taken from the values generated in the student_anonymoususerid table from the edxapp database.

I might have a SECRET_KEY issue because notes previously created in Native (Koa) no longer appear in a course where they were previously generated. Only new notes created in Tutor (Nutmeg) appear with a new user_id generated in Nutmeg. It’s as if the Tutor-Notes plugin is unable to recognize there were entries created with a different SECRET_KEY.

Since I am not in Production yet, this is not a major issue right now, but is there a way to switch either the SECRET_KEY for edx-platform and/or notes in Nutmeg so that it reuses or regenerates the anonymous_user_id for a specific user?

Now, that is interesting…

In the student_anonymoususerid table, there are multiple entries for the same user_id. Most also have a course_id but it can be NULL.

The entries with NULL seem to be used by the notes features. As I was on a test system, I noticed my user had 3 different entries with a NULL course_id. I knew the first entry in the table had notes displayed in one course under Native but none in the same course under Tutor.

I removed the last two entries.

And suddenly the notes showed up in Tutor.

Is this a bug?
Is this a feature?
Could it be that notes doesn’t recognize previous anonymoususerid created for a user and only uses the latest one?

I know it’s a longshot, but @feanil could this be a side-effect from [DEPR]: Cleanup: Remove last vestiges of save option from anonymous_id_for_user · Issue #35 · openedx/public-engineering · GitHub or anything similar related to the student_anonymoususerid table ? I am moving from Native-Koa to Tutor-Nutmeg.

I just looked at the code that was merged for the anonymous_id_for_user changes and I don’t think it is related to the latest change which just removed an unused parameter.

Previously the system would create ananymous IDs using the secret key. The change that preceded the most recent change ensured that if a key already existed it would be used before a new one is created. So if the secret key changed previously, it could have introduced multiple anonymous IDs for the same user.

Thanks @feanil that’s what I thought could be happening.

And the notes application only picks up the latest anonymous ID for a specific user. At least in Nutmeg. I’ll make sure to check on our secret key when we will migrate our production environment.

It may not be a popular feature for most of our courses, but we still have a few courses using the notes feature. A ridiculous amount of courses and users to be honest.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.