Custom quiz integration

Home Forums Legacy Support Support queries How-to & Troubleshooting Custom quiz integration

Viewing 15 posts - 16 through 30 (of 41 total)
  • Author
    Posts
  • #234415
    proskurius
    Participant
    How's it going? I just need API documentation for submitting quiz results.
    #234625
    proskurius
    Participant
    I'm waiting for your reply.
    #234652
    Scott Lang
    Moderator
    #234660
    proskurius
    Participant
    Thank you! A few questions =)
    1. What properties of "results" are required?
    2. May be i have to create custom question type for Go problems?
    3. Why do the "results" contain all the information about questions: "type", "explanation", "content" etc?? More simple to submit question id only. Am I missing something here?
    4. Is it possible to POST smth like this in my case?
    {
      "quiz_id": "714",
      "course_id": 710,
      "results": [
        {      
          "marks": 2,
          "user_marks": 0,
          "status": 2,
          "marked": 1,
          "auto": 1
        },
        {      
          "marks": 2,
          "user_marks": 0,
          "status": 2,
          "marked": "1",
          "auto": 1
        },
    ]
    }
    1. And what does means these properties: "marks", "user_marks", "status", "marked", "auto"?
    #234796
    Scott Lang
    Moderator
    Hi, Basically, in-app we get the question and after user attempt, we modified the question and send back to the server Marks = how much mark question is User marks = How much marks user get for question Status = Not in use Marked = what use marks like true/false or selected 1,2,4,3 Auto = Use for quiz evaluation and result add for the user Also, you can refer this function function add_user_result($request) in vibe-course-module plugin Maybe i have to create custom question type for Go problems? Please explain
    #236208
    proskurius
    Participant
    Hello.
    1. I embedded my Go problems into Quiz content with shortcode, but it's not displayed. If I embed them into Unit content — it works fine, if I embed H5P quiz to Quiz content — it works ok too. I want to embed my Go problems like a H5P quiz.
    2. At the end of my quiz I call this function:
    SubmitResultToWPLMS(total) { let unit = document.getElementById('unit'); let quiz_id = unit.dataset.unit; fetch('http://dev24.gomagic.org/wp-json/user/submitresult/' , { method: 'POST', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': 'RMkD$k0v' }, body: JSON.stringify( { 'quiz_id': quiz_id, 'marks': total.max_marks, 'user_marks': total.marks } ) }).then( res => res.json()); } Is it ok? I simply want to submit only total marks. I insert this code with a CODE tag (`). In the past messages there were problems with displaying. Could you, please, fix it?
    1. I can give you access to my website, if necessary.
    #236215
    proskurius
    Participant
    One problem else. My Go problems don't work in ajax mode. What should I do for it?
    #236304
    Anshuman Sahu
    Keymaster
    Please try enabling " Disable ajax in Course unit load " from wp-admin -> lms -> settings.   For submit results api call.   No it will not store the total marks of the user if you send it. You will have to send the data like we told you in our previous replies . atleast and array of json objects of question containing these two properties : user_marks : scored marks by the user . and marks : marks of the question .   eg :   [ { 'user_marks'=>4 'marks'=>4 }, { 'user_marks'=>2 'marks'=>4 } ]    
    #236311
    proskurius
    Participant
    Of course I can disable ajax, but I want use it. So I can submit marks only for every question without "type" and other properties, right? What about my first question? I can't use my web Go board in Quiz content.
    #236335
    Anshuman Sahu
    Keymaster
    yes you can submit without anything to record the marks in quiz for the user .   but I want use it : could you please tell exactly  what do you  need .Do you want your Go quiz working with ajax ? for that we have to integrate it with wplms which may take time .
    #236339
    proskurius
    Participant
    Ok. Thanks. But how can I embed my Go quiz into WPLMS Quiz content?? Yes, I want my Go quiz working with ajax. What is the general problem? What should I do?
    #236491
    Anshuman Sahu
    Keymaster
    Well problem may appear with go quiz and on course status page the unit's or quiz's content is fetched from database and shown there and most of plugin's script does not load and hence their shortcodes does not works there . This is why we asked you to disable the ajax which actually solves this issue . But how can I embed my Go quiz into WPLMS Quiz content?? That is upto you .You can add the go quiz in unit itself .
    #236579
    proskurius
    Participant
    Oh! I don't have to add the Go quiz to Quiz content? Will it work in usual Unit content and collect results? I will try. Thanks. I disable ajax mode now, and it works ok. But using ajax in the future would be great.
    #236607
    proskurius
    Participant
    I have error: POST http://dev24.gomagic.org/wp-json/wplms/v1/user/submitresult/ 401 (Unauthorized) I double-checked API Security State and tried do like here: https://wplms.io/forums/topic/rest-api-401-unauthorized/
    #236616
    proskurius
    Participant
    Also I tried to create app with secret token and use secret token in 'Authorization' header. "Enable oAuth2 Server" and "Enable Registrations via API" are checked in Api settings.
Viewing 15 posts - 16 through 30 (of 41 total)
  • The topic ‘Custom quiz integration’ is closed to new replies.