RunestoneInteractive / rs

A New Monorepo structure for Runestone
Other
42 stars 69 forks source link

Toggle questions do not update activity counter #55

Open bhoffman0 opened 3 years ago

bhoffman0 commented 3 years ago

@vqum the toggle questions are not updating the activity counter at the bottom of the page which is still stuck at 1 after completing them. See https://runestone.academy/runestone/books/published/py4e-int/functions/functions_mixedupcode.html , do problem 1 and check activity counter at bottom: image

Ebenezer997 commented 3 years ago

@bhoffman0 ”Has this issue been resolved?”

bhoffman0 commented 3 years ago

No it's does not work.

vqum commented 3 years ago

I am looking into this issue

bnmnetp commented 3 years ago

The problem for the activity counting and the toggle questions comes from the following:

The server (see books.py) queries the database to get a list of all of the components on the page, using the chapter, subchapter, and basecourse. This data comes from the questions table in the database. This list is transformed to a dictionary with a value of 0 or 1 to indicate whether the user has interacted with the component at some point in the past.

This list is embedded in the eBookConfig object as part of the page when it is served:

eBookConfig.activities = {"select_u1_muc_wc14": 0, "select_u1_muc_wc13": 0, "select_u1_muc_wc12": 0,
 "select_u1_muc_wc10": 0, "select_u1_muc_wc9": 0, "select_u1_muc_wc8": 0, "select_u1_muc_wc6": 0,
 "select_u1_muc_wc3": 0, "select_u1_muc_wc2": 0, "select_u1_muc_wc7": 0, "select_u1_muc_wc5": 0, 
"select_u1_muc_wc4": 0, "select_u1_muc_wc11": 0, "select_u1_muc_wc1": 0, 
"1. Getting Started and Primitive Types/1.9 Experimental: Choose Mixed Up or Write Code Practice": 0}

Notice that the keys are the unique identifiers for the selectquestion. None of the actual questions are in this data structure.

when the student interacts with one of the actual questions the code attempts to update this dictionary, using activities[div_id]++ the keys is added to the dictionary but the value ends up as NaN. So the total never increases.

We have multiple issues

  1. The actual questions for 1.9 are in the database but their chapter is HiddenFiles and their subchapter is topic-1-8-toggle-write-code So, they will never get selected and added to the data structure by the server.
  2. Because the code assumes that the key will be in the dictionary we end up with a NaN
  3. It is not clear how we should be counting the activities. If a student does both the parsons and the activecode should that still only count as one thing?

Solution idea 1

  1. Make use of the :chapter: and :subchapter: options on the actual questions so that they match the chapter and subchapter that contains the selectquestion. This way they will be included in the list and we'll be able to pick up on the historical interactions with them.
  2. Mark the select questions as :optional: so that they are not included in the list. -- I think this is the right plan because we are never going to have an entry in the database for activity on the selectquestion.
  3. If we just do that then we will at least show some progress, but unless a student does both options for every question they will never get to 100% for a page like 1.9

Solution idea 2

  1. Don't do any of the things in idea 1
  2. Each actual question that is part of a toggle questions knows the id of the selectquestion. if this.selector_id is not undefined then we know this question is part of a selectquestion / toggle question. If this attribute is present then pass selector_id to the updateProgress method (see runestonebase.js)
  3. If that is all we do that will count 1 for every toggle question on the page. and it will seem seem correct to the student (I think). But we will also need to add an event to the log for the selectquestion as well otherwise when the page is reloaded the counts for all the toggle questions will reset to 0.
  4. (alternate 3) The other possible solution to the second half of 3 is to make the logic on the server more complicated and have it detect that the question is a selectquestion and then go looking for the associated actual question (if it is there). I'm not a fan of this as I want to keep the logic for serving pages as simple and fast as possible.

@barbarer @bhoffman0 @vqum What do you all think??

barbarer commented 3 years ago

For the :toggle: I want the ebook to score whichever question the user selected. I do want them to get points for doing the toggle questions.

Doesn't an assignment know all the questions in the assignment? If so can't we just determine which question in a select question was actually selected and score that?

Dr. Barbara Ericson Assistant Professor, School of Information University of Michigan

On Tue, Aug 31, 2021 at 9:49 AM Bradley Miller @.***> wrote:

The problem for the activity counting and the toggle questions comes from the following:

The server (see books.py) queries the database to get a list of all of the components on the page, using the chapter, subchapter, and basecourse. This data comes from the questions table in the database. This list is transformed to a dictionary with a value of 0 or 1 to indicate whether the user has interacted with the component at some point in the past.

This list is embedded in the eBookConfig object as part of the page when it is served:

eBookConfig.activities = {"select_u1_muc_wc14": 0, "select_u1_muc_wc13": 0, "select_u1_muc_wc12": 0, "select_u1_muc_wc10": 0, "select_u1_muc_wc9": 0, "select_u1_muc_wc8": 0, "select_u1_muc_wc6": 0, "select_u1_muc_wc3": 0, "select_u1_muc_wc2": 0, "select_u1_muc_wc7": 0, "select_u1_muc_wc5": 0, "select_u1_muc_wc4": 0, "select_u1_muc_wc11": 0, "select_u1_muc_wc1": 0, "1. Getting Started and Primitive Types/1.9 Experimental: Choose Mixed Up or Write Code Practice": 0}

Notice that the keys are the unique identifiers for the selectquestion. None of the actual questions are in this data structure.

when the student interacts with one of the actual questions the code attempts to update this dictionary, using activities[div_id]++ the keys is added to the dictionary but the value ends up as NaN. So the total never increases. We have multiple issues

  1. The actual questions for 1.9 are in the database but their chapter is HiddenFiles and their subchapter is topic-1-8-toggle-write-code So, they will never get selected and added to the data structure by the server.
  2. Because the code assumes that the key will be in the dictionary we end up with a NaN
  3. It is not clear how we should be counting the activities. If a student does both the parsons and the activecode should that still only count as one thing?

Solution idea 1

  1. Make use of the :chapter: and :subchapter: options on the actual questions so that they match the chapter and subchapter that contains the selectquestion. This way they will be included in the list and we'll be able to pick up on the historical interactions with them.
  2. Mark the select questions as :optional: so that they are not included in the list. -- I think this is the right plan because we are never going to have an entry in the database for activity on the selectquestion.
  3. If we just do that then we will at least show some progress, but unless a student does both options for every question they will never get to 100% for a page like 1.9

Solution idea 2

  1. Don't do any of the things in idea 1
  2. Each actual question that is part of a toggle questions knows the id of the selectquestion. if this.selector_id is not undefined then we know this question is part of a selectquestion / toggle question. If this attribute is present then pass selector_id to the updateProgress method (see runestonebase.js)
  3. If that is all we do that will count 1 for every toggle question on the page. and it will seem seem correct to the student (I think). But we will also need to add an event to the log for the selectquestion as well otherwise when the page is reloaded the counts for all the toggle questions will reset to 0.
  4. (alternate 3) The other possible solution to the second half of 3 is to make the logic on the server more complicated and have it detect that the question is a selectquestion and then go looking for the associated actual question (if it is there). I'm not a fan of this as I want to keep the logic for serving pages as simple and fast as possible.

@barbarer https://github.com/barbarer @bhoffman0 https://github.com/bhoffman0 @vqum https://github.com/vqum What do you all think??

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/RunestoneInteractive/rs/issues/55, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKOZ7MYUFFLEKGWIUKY2Y3DT7TMX7ANCNFSM5COWUREQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

bnmnetp commented 3 years ago

Yes, that is what the autograder will do, this issue is about the progress bar at the bottom of the page.

barbarer commented 3 years ago

Ah, then I lean toward solution 2. I want the select question to count as one activity.

Dr. Barbara Ericson Assistant Professor, School of Information University of Michigan

On Tue, Aug 31, 2021 at 9:59 AM Bradley Miller @.***> wrote:

Yes, that is what the autograder will do, this issue is about the progress bar at the bottom of the page.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/RunestoneInteractive/rs/issues/55, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKOZ7M5KRTMHH4LGT7TZVXTT7TN4LANCNFSM5COWUREQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

bnmnetp commented 3 years ago

If @bhoffman0 agrees, then we should implement solution 2. @vqum do you think you can get it done by Friday or should I go ahead and do this? I would really like to have it in the build so that it is working for CSAwesome by next week.

bhoffman0 commented 3 years ago

Sounds good to me. Thanks for working on this!

vqum commented 3 years ago

@bnmnetp I'm still encountering issues with building local Runestone server on my machine. I could try to tackle this, but any code I produce would be written blind since I have no way to test it locally.

bnmnetp commented 3 years ago

OK, I don't think it will take me very long at all to do this, since I've looked at all the code just today trying to figure out what was going wrong.

I'm sorry you are having trouble. I've just done two machines from scratch in the last two days getting prepared to test the new peer instruction features. I really don't know what the problem could be for you.

bnmnetp commented 3 years ago

OK, fixed. This will be in the build for Saturday.

Also fixed the autograder for toggle questions in a reading assignment. It turned out to be easier than I thought as we were just missing a default value for the points, which is just 1 for an activity in a reading assignment.

bhoffman0 commented 3 years ago

Wow awesome! Thank you!

barbarer commented 3 years ago

Terrific!

Dr. Barbara Ericson Assistant Professor, School of Information University of Michigan

On Tue, Aug 31, 2021 at 4:14 PM Bradley Miller @.***> wrote:

OK, fixed. This will be in the build for Saturday.

Also fixed the autograder for toggle questions in a reading assignment. It turned out to be easier than I thought as we were just missing a default value for the points, which is just 1 for an activity in a reading assignment.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/RunestoneInteractive/rs/issues/55, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKOZ7M3NV7B7CEH5KGJOO4DT7UZ2DANCNFSM5COWUREQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.