Possible bug when adding new users to a course

aotu
Hello, Whilst creating a new View I've spotted a potential bug. It looks like when users are added to a course they aren't automatically set to "Not Started" in the database. For clarity, I'll explain the potential bug as I came across it. Create a simple View to show the logged in user all lessons in a course, alongside their current Lesson State 'Not started...In progress..etc' Add a test course Add the admin + studentA to the test course Add some test lessons to the test course Test the view as admin & as student When testing the view, the Admin and StudentA see all lessons and their status. However, in the views output their 'Lesson Status' is 'In progress', as opposed to the expected 'Not started' Add a new student to the course (studentB) When testing the view, studentB sees no lessons at all. For testing purposes, I edited a test lesson in the test course (in order to create a new revision of it). When testing the view now, studentB can now see the single edited lesson but still no others in the course. Their 'Lesson Status' is set to 'In progress' instead of the expected 'Not started' This testing leads me to believe that when students are added to a course, the 'Not started' flag isn't being set, and also when a revision is created the status defaults to 'In progress' when it's expected to default to 'Not started' Do you have any ideas for how I can fix this? Thanks, Gavin
Profile picture for user James Aparicio
James Aparicio

Hi aotu,

Hi aotu,

There is no such thing as a flag "Not started". Not started is simply result of the user not having any entry in the database for a given quiz.

The issue is in your view. I recomment going to the view settings and enabling show sql. This way you can see the query that is beeing ran, and then run and test the sql directly in the database to check what is happening.

 

Best regards 

aotu

Hi James,

Hi James, Thanks for clarifying, my confusion came from the "Quiz Results: Lesson State" having a checkbox for three items 'Not started, In Progress, Finished', hence I assume 'Not started' should have been added as an entry when a student is added to a course+quizzes. If 'Not Started' is never added to the db, I'm still confused as to the behaviour around 'In progress', is the behaviour below functioning as designed? Simple view: Type 'Lesson' Fields: Title, Lesson state Filter: Lesson state (show all states), Quiz results: user (logged in user) 1. Add new user (studentC) to Opigno & subscribe to the course 2. Log in as studentC, they only see 2/7 quizzes (both of different type, no idea what's significant about them) 3. Log in as admin, save each quiz so as to create a new revision 4. Log in as studentC, they now see 7/7 quizzes It seems that when I update a quiz, all members are set to 'In Progress', however when adding new members to a quiz...that doesn't happen. Is this expected behaviour? If so, I'm afraid my view structure isn't going to work....or at least I can't see a way to get a View to run the simple task I need it to :/ Thanks again. Gavin
Profile picture for user James Aparicio
James Aparicio

Hi aotu

Hi aotu

I just looked at the file quiz_views_handler_field_user_quiz_state.inc inside the quiz module, and i only see there finished and in progress, try returning Not started if is_finished=null

Best regards