【问题标题】:Check if student submitted assignment via Moodle web services检查学生是否通过 Moodle 网络服务提交作业
【发布时间】:2021-03-31 10:28:49
【问题描述】:

我正在尝试使用 Moodle API(网络服务)来获取有关(我的)作业提交的信息。我想知道我是否已经提交了作业尝试。我正在使用mod_assign_get_assignments 函数(没有太多文档),我得到的结果(查看每门课程的assignments 部分时)是:

{
  "id": 25960,
  "cmid": 350053,
  "course": 8013502,
  "name": "\u05d4\u05d2\u05e9\u05ea \u05ea\u05e8\u05d2\u05d9\u05dc \u05d1\u05d9\u05ea 1",
  "nosubmissions": 0,
  "submissiondrafts": 0,
  "sendnotifications": 0,
  "sendlatenotifications": 0,
  "sendstudentnotifications": 0,
  "duedate": 1617566400,
  "allowsubmissionsfromdate": 0,
  "grade": 100,
  "timemodified": 1615897679,
  "completionsubmit": 1,
  "cutoffdate": 1617569940,
  "gradingduedate": 0,
  "teamsubmission": 0,
  "requireallteammemberssubmit": 0,
  "teamsubmissiongroupingid": 0,
  "blindmarking": 0,
  "hidegrader": 0,
  "revealidentities": 0,
  "attemptreopenmethod": "manual",
  "maxattempts": 1,
  "markingworkflow": 0,
  "markingallocation": 0,
  "requiresubmissionstatement": 0,
  "preventsubmissionnotingroup": 0
   ...irrelevant configuations
}

以上结果是我已经提交的作业。

我未提交的作业示例如下:

{
  "id": 19764,
  "cmid": 268225,
  "course": 8013201,
  "name": "\u05ea\u05d9\u05d1\u05ea \u05d4\u05d2\u05e9\u05d4 14",
  "nosubmissions": 0,
  "submissiondrafts": 0,
  "sendnotifications": 0,
  "sendlatenotifications": 0,
  "sendstudentnotifications": 0,
  "duedate": 1611693000,
  "allowsubmissionsfromdate": 0,
  "grade": 100,
  "timemodified": 1610972842,
  "completionsubmit": 0,
  "cutoffdate": 1611694860,
  "gradingduedate": 0,
  "teamsubmission": 0,
  "requireallteammemberssubmit": 0,
  "teamsubmissiongroupingid": 0,
  "blindmarking": 0,
  "hidegrader": 0,
  "revealidentities": 0,
  "attemptreopenmethod": "manual",
  "maxattempts": 1,
  "markingworkflow": 0,
  "markingallocation": 0,
  "requiresubmissionstatement": 0,
  "preventsubmissionnotingroup": 0
   ...irrelevant configuations
}

这些之间唯一明显的区别(可能指向一种检查我是否提交的方法)是completionsubmit 属性,但这不是解决方案,因为我提交的不同分配将其设置为0(就像我没有提交的一样)。

有人知道我该如何解决这个问题吗?

提前致谢!

编辑: mod_assign_get_submissions 拒绝我的访问

{"assignments":[],"warnings":[{"item":"assignment","itemid":myitemname,"warningcode":"1","message":"No access rights in module context"}]}

我现在查看了mod_assign_get_submission_status,但它似乎一次只能解析一个作业,有没有人有办法提高效率?

【问题讨论】:

    标签: moodle moodle-api


    【解决方案1】:

    您可以尝试使用mod_assign_get_submissions 来检索作业提交。自 Moodle 2.5 起可用

    参考文献

    示例响应

    {
        "assignments": [
            {
                "assignmentid": 14,
                "submissions": [
                    {
                        "id": 7,
                        "userid": 3,
                        "attemptnumber": 0,
                        "timecreated": 1426865031,
                        "timemodified": 1426865062,
                        "status": "submitted",
                        "groupid": 0,
                        "plugins": [
                            {
                                "type": "onlinetext",
                                "name": "Online text",
                                "fileareas": [
                                    {
                                        "area": "submissions_onlinetext"
                                    }
                                ],
                                "editorfields": [
                                    {
                                        "name": "onlinetext",
                                        "description": "Submission comments",
                                        "text": "<p>But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful.&nbsp;<br></p>",
                                        "format": 1
                                    }
                                ]
                            },
                            {
                                "type": "file",
                                "name": "File submissions",
                                "fileareas": [
                                    {
                                        "area": "submission_files",
                                        "files": [
                                            {
                                                "filepath": "APDFfile.pdf",
                                                "fileurl": "http://localhost/m/stable_master/webservice/pluginfile.php/247/assignsubmission_file/submission_files/12/somefile.pdf"
                                            },
                                            {
                                                "filepath": "anotherfile.docx",
                                                "fileurl": "http://localhost/m/stable_master/webservice/pluginfile.php/247/assignsubmission_file/submission_files/12/somefile.pdf"
                                            }
                                        ]
                                    }
                                ]
                            },
                            {
                                "type": "comments",
                                "name": "Submission comments"
                            }
                        ]
                    },
                    {
                        "id": 5,
                        "userid": 4,
                        "attemptnumber": 0,
                        "timecreated": 1426864693,
                        "timemodified": 1426864740,
                        "status": "draft",
                        "groupid": 0,
                        "plugins": [
                            {
                                "type": "onlinetext",
                                "name": "Online text",
                                "fileareas": [
                                    {
                                        "area": "submissions_onlinetext",
                                        "files": [
                                            {
                                                "filepath": "/Arte esquemático-Cigüeña.png",
                                                "fileurl": "http://localhost/m/stable_master/webservice/pluginfile.php/245/assignsubmission_onlinetext/submissions_onlinetext/5/Arte%20esquem%C3%A1tico-Cig%C3%BCe%C3%B1a.png"
                                            }
                                        ]
                                    }
                                ],
                                "editorfields": [
                                    {
                                        "name": "onlinetext",
                                        "description": "Submission comments",
                                        "text": "<p>Blah Blah Blah lorem ipsum</p><p><br></p><p><b>Blah Blah Blah lorem ipsum</b><br></p><p><b><br></b></p><p><b><span style=\"font-weight: normal;\"><i>Blah Blah Blah lorem ipsum</i></span><br></b></p><p><b><span style=\"font-weight: normal;\"><i><br></i></span></b></p><p><b><span style=\"font-weight: normal;\"><i><img src=\"@@PLUGINFILE@@/Arte%20esquem%C3%A1tico-Cig%C3%BCe%C3%B1a.png\" alt=\"\" width=\"734\" height=\"844\" role=\"presentation\" style=\"vertical-align:text-bottom; margin: 0 .5em;\" class=\"img-responsive\"><br></i></span></b></p>",
                                        "format": 1
                                    }
                                ]
                            },
                            {
                                "type": "file",
                                "name": "File submissions",
                                "fileareas": [
                                    {
                                        "area": "submission_files",
                                        "files": [
                                            {
                                                "filepath": "somefile.pdf",
                                                "fileurl": "http://localhost/m/stable_master/webservice/pluginfile.php/247/assignsubmission_file/submission_files/12/somefile.pdf"
                                            }
                                        ]
                                    }
                                ]
                            },
                            {
                                "type": "comments",
                                "name": "Submission comments"
                            }
                        ]
                    }
                ]
            }
        ],
        "warnings": []
    }
    

    【讨论】:

    • 感谢您的回复,我尝试了您的方法,有关详细信息,请参阅我编辑的问题:)
    猜你喜欢
    • 2021-09-23
    • 2012-04-22
    • 2022-01-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多