"user_state_summary" scope being not readable for the editor?

Hello everyone.

I’m developing a XBlock to be used in Open edX.
I’m currently experimenting with the different types of Scope.

I noticed that if a variable uses the Scope.content, then the editor can both read and write on it, while the student can only read it’s value.

I tried doing opposite too, a scope that can be edited and read by the student, but only read by the editor. I tested that when there is a “Scope.user_state_summary” variable, the editor can’t see any modifications made by the student (it will always be the default value, if set).

Is this a normal behaviour? Or is it a bug?

I’m currently using Bitnami Open edX virtual machine (koa.3-1)

Thank you.

Hi @AyaTachibana,

That is expected behavior.

Scope.content is for holding “authored” content created by the course author, so it can be written in Studio but not from the LMS.

Whereas Scope.user_state_summary is for things like tracking how many students have answered a question, or for storing poll results (e.g. see how it’s used in xblock-poll). So it’s only relevant to the LMS. Both instructors/authors and students should be able to see the state (the value of such fields), but probably only in the LMS. In Studio, it will just show a default/dummy value. So if you want authors or instructors to see that data, just let them view it in the LMS and it should work.

Please keep in mind that XBlock fields have no locking capabilities, so if you have many users writing to a Scope.user_state_summary field at the same time, their changes may overwrite each other or conflict. So it’s not a good choice for huge courses with many students simultaneously writing to the same XBlock.

I hope this helps.

1 Like