Exemplo n.º 1
0
Arquivo: peer.py Projeto: kq2/Ricin
def make_solution_page(course, assignment, canvas_id, title, file_name):
    page = ""
    questions = assignment["form"][1]["children"]
    for question in questions:
        html = wiki.convert_content(question["html"], course)
        page += html
        for evaluation in question["evaluation"]["children"]:
            if evaluation["children"][0]["type"] == "gradingNumber":
                html = wiki.convert_content(evaluation["html"], course)
                page += u"<p>{}</p>".format(html)

    canvas_id = "wiki_{}_solution".format(canvas_id)
    canvas_path = "wiki_content/{}-solution.html".format(file_name)
    canvas_file = "{}/{}".format(course.get_canvas_folder(), canvas_path)
    title = "{} solution".format(title)

    wiki.make_canvas_wiki(page, title, canvas_file, canvas_id, course)
    args = {"id": canvas_id, "type": "webcontent", "path": canvas_path, "files": resource.FILE.format(canvas_path)}
    course.add_resources(args)
Exemplo n.º 2
0
Arquivo: peer.py Projeto: kq2/Ricin
def make_description_page(course, assignment, canvas_id, title, file_name):
    page = ""

    intros = assignment["form"][0]["children"]
    for intro in intros:
        html = wiki.convert_content(intro["html"], course)
        page += u"<p>{}</p>".format(html)

    questions = assignment["form"][1]["children"]
    for question in questions:
        html = wiki.convert_content(question["html"], course)
        page += u"<p>{}</p>".format(html)

    canvas_id = "wiki_{}".format(canvas_id)
    canvas_path = "wiki_content/{}.html".format(file_name)
    canvas_file = course.get_canvas_folder() + "/" + canvas_path

    wiki.make_canvas_wiki(page, title, canvas_file, canvas_id, course)

    args = {"id": canvas_id, "type": "webcontent", "path": canvas_path, "files": resource.FILE.format(canvas_path)}
    course.add_resources(args)