本文整理汇总了Python中submissions.api.get_submissions函数的典型用法代码示例。如果您正苦于以下问题:Python get_submissions函数的具体用法?Python get_submissions怎么用?Python get_submissions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_submissions函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_two_students
def test_two_students(self):
api.create_submission(STUDENT_ITEM, ANSWER_ONE)
api.create_submission(SECOND_STUDENT_ITEM, ANSWER_TWO)
submissions = api.get_submissions(STUDENT_ITEM)
self.assertEqual(1, len(submissions))
self._assert_submission(submissions[0], ANSWER_ONE, 1, 1)
submissions = api.get_submissions(SECOND_STUDENT_ITEM)
self.assertEqual(1, len(submissions))
self._assert_submission(submissions[0], ANSWER_TWO, 2, 1)
开发者ID:ctpad,项目名称:edx-tim,代码行数:11,代码来源:test_api.py
示例2: get_submissions_for_student_item
def get_submissions_for_student_item(request, course_id, student_id, item_id):
"""Retrieve all submissions associated with the given student item.
Developer utility for accessing all the submissions associated with a
student item. The student item is specified by the unique combination of
course, student, and item.
Args:
request (dict): The request.
course_id (str): The course id for this student item.
student_id (str): The student id for this student item.
item_id (str): The item id for this student item.
Returns:
HttpResponse: The response object for this request. Renders a simple
development page with all the submissions related to the specified
student item.
"""
student_item_dict = dict(
course_id=course_id,
student_id=student_id,
item_id=item_id,
)
context = dict(**student_item_dict)
try:
submissions = get_submissions(student_item_dict)
context["submissions"] = submissions
except SubmissionRequestError:
context["error"] = "The specified student item was not found."
return render_to_response('submissions.html', context)
开发者ID:edx,项目名称:edx-submissions,代码行数:32,代码来源:views.py
示例3: clear_student_state
def clear_student_state(self, user_id, course_id, item_id):
"""
This xblock method is called (from our LMS runtime, which defines this method signature) to clear student state
for a given problem. It will cancel the workflow using traditional methods to remove it from the grading pools,
and pass through to the submissions API to orphan the submission so that the user can create a new one.
"""
# Note that student_item cannot be constructed using get_student_item_dict, since we're in a staff context
student_item = {
'course_id': course_id,
'student_id': user_id,
'item_id': item_id,
'item_type': 'openassessment',
}
# There *should* only be one submission, but the logic is easy to extend for multiples so we may as well do it
submissions = submission_api.get_submissions(student_item)
for sub in submissions:
# Remove the submission from grading pools
self._cancel_workflow(sub['uuid'], "Student state cleared")
# Tell the submissions API to orphan the submission to prevent it from being accessed
submission_api.reset_score(
user_id,
course_id,
item_id,
clear_state=True # pylint: disable=unexpected-keyword-arg
)
开发者ID:bhallapoorva,项目名称:edx-ora2,代码行数:26,代码来源:staff_area_mixin.py
示例4: test_create_submissions
def test_create_submissions(self):
# Create some submissions
cmd = create_oa_submissions.Command(**{'self_assessment_required': True})
cmd.handle("test_course", "test_item", "5", 100)
self.assertEqual(len(cmd.student_items), 5)
for student_item in cmd.student_items:
# Check that the student item was created for the right course / item
self.assertEqual(student_item['course_id'], 'test_course')
self.assertEqual(student_item['item_id'], 'test_item')
# Check that a submission was created
submissions = sub_api.get_submissions(student_item)
self.assertEqual(len(submissions), 1)
answer_dict = submissions[0]['answer']
self.assertIsInstance(answer_dict['text'], basestring)
self.assertGreater(len(answer_dict['text']), 0)
# Check that peer and self assessments were created
assessments = peer_api.get_assessments(submissions[0]['uuid'])
# Verify that the assessments exist and have content
self.assertEqual(len(assessments), cmd.NUM_PEER_ASSESSMENTS)
for assessment in assessments:
self.assertGreater(assessment['points_possible'], 0)
# Check that a self-assessment was created
assessment = self_api.get_assessment(submissions[0]['uuid'])
# Verify that the assessment exists and has content
self.assertIsNot(assessment, None)
self.assertGreater(assessment['points_possible'], 0)
开发者ID:Akif-Vohra,项目名称:edx-ora2,代码行数:35,代码来源:test_create_oa_submissions.py
示例5: test_get_submissions
def test_get_submissions(self):
api.create_submission(STUDENT_ITEM, ANSWER_ONE)
api.create_submission(STUDENT_ITEM, ANSWER_TWO)
submissions = api.get_submissions(STUDENT_ITEM)
self._assert_submission(submissions[1], ANSWER_ONE, 1, 1)
self._assert_submission(submissions[0], ANSWER_TWO, 1, 2)
开发者ID:ctpad,项目名称:edx-tim,代码行数:7,代码来源:test_api.py
示例6: test_get_submissions
def test_get_submissions(self):
api.create_submission(STUDENT_ITEM, ANSWER_ONE)
api.create_submission(STUDENT_ITEM, ANSWER_TWO)
submissions = api.get_submissions(STUDENT_ITEM)
student_item = self._get_student_item(STUDENT_ITEM)
self._assert_submission(submissions[1], ANSWER_ONE, student_item.pk, 1)
self._assert_submission(submissions[0], ANSWER_TWO, student_item.pk, 2)
开发者ID:YoshidaKS,项目名称:edx-ora2,代码行数:8,代码来源:test_api.py
示例7: get_submission
def get_submission(self, submission_id=None):
"""
Get student's most recent submission.
"""
submissions = submissions_api.get_submissions(
self.student_submission_id(submission_id))
if submissions:
# If I understand docs correctly, most recent submission should
# be first
return submissions[0]
开发者ID:eduStack,项目名称:edx-sga,代码行数:10,代码来源:sga.py
示例8: get_student_info_path_and_context
def get_student_info_path_and_context(self, data):
"""
Get the proper path and context for rendering the the student info
section of the staff debug panel.
"""
student_id = data.params.get('student_id', '')
submission_uuid = None
submission = None
assessment_steps = self.assessment_steps
if student_id:
student_item = self.get_student_item_dict()
student_item['student_id'] = student_id
# If there is a submission available for the requested student, present
# it. If not, there will be no other information to collect.
submissions = submission_api.get_submissions(student_item, 1)
if submissions:
submission = submissions[0]
submission_uuid = submissions[0]['uuid']
example_based_assessment = None
self_assessment = None
peer_assessments = []
submitted_assessments = []
if "peer-assessment" in assessment_steps:
peer_assessments = peer_api.get_assessments(submission_uuid)
submitted_assessments = peer_api.get_submitted_assessments(submission_uuid, scored_only=False)
if "self-assessment" in assessment_steps:
self_assessment = self_api.get_assessment(submission_uuid)
if "example-based-assessment" in assessment_steps:
example_based_assessment = ai_api.get_latest_assessment(submission_uuid)
context = {
'submission': submission,
'peer_assessments': peer_assessments,
'submitted_assessments': submitted_assessments,
'self_assessment': self_assessment,
'example_based_assessment': example_based_assessment,
'rubric_criteria': copy.deepcopy(self.rubric_criteria),
}
if peer_assessments or self_assessment or example_based_assessment:
max_scores = peer_api.get_rubric_max_scores(submission_uuid)
for criterion in context["rubric_criteria"]:
criterion["total_value"] = max_scores[criterion["name"]]
path = 'openassessmentblock/staff_debug/student_info.html'
return path, context
开发者ID:caesar2164,项目名称:edx-ora2,代码行数:54,代码来源:staff_info_mixin.py
示例9: test_get_latest_submission
def test_get_latest_submission(self):
past_date = datetime.datetime(2007, 9, 12, 0, 0, 0, 0, pytz.UTC)
more_recent_date = datetime.datetime(2007, 9, 13, 0, 0, 0, 0, pytz.UTC)
api.create_submission(STUDENT_ITEM, ANSWER_ONE, more_recent_date)
api.create_submission(STUDENT_ITEM, ANSWER_TWO, past_date)
# Test a limit on the submissions
submissions = api.get_submissions(STUDENT_ITEM, 1)
self.assertEqual(1, len(submissions))
self.assertEqual(ANSWER_ONE, submissions[0]["answer"])
self.assertEqual(more_recent_date.year,
submissions[0]["submitted_at"].year)
开发者ID:YoshidaKS,项目名称:edx-ora2,代码行数:12,代码来源:test_api.py
示例10: get_student_info_path_and_context
def get_student_info_path_and_context(self, data):
"""
Get the proper path and context for rendering the the student info
section of the staff debug panel.
"""
student_id = data.params.get("student_id", "")
submission_uuid = None
submission = None
assessment_steps = self.assessment_steps
if student_id:
student_item = self.get_student_item_dict()
student_item["student_id"] = student_id
# If there is a submission available for the requested student, present
# it. If not, there will be no other information to collect.
submissions = submission_api.get_submissions(student_item, 1)
if submissions:
submission = submissions[0]
submission_uuid = submissions[0]["uuid"]
if "peer-assessment" in assessment_steps:
peer_assessments = peer_api.get_assessments(submission_uuid)
submitted_assessments = peer_api.get_submitted_assessments(submission_uuid, scored_only=False)
else:
peer_assessments = []
submitted_assessments = []
if "self-assessment" in assessment_steps:
self_assessment = self_api.get_assessment(submission_uuid)
else:
self_assessment = None
context = {
"submission": submission,
"peer_assessments": peer_assessments,
"submitted_assessments": submitted_assessments,
"self_assessment": self_assessment,
"rubric_criteria": copy.deepcopy(self.rubric_criteria),
}
if peer_assessments or self_assessment:
max_scores = peer_api.get_rubric_max_scores(submission_uuid)
for criterion in context["rubric_criteria"]:
criterion["total_value"] = max_scores[criterion["name"]]
path = "openassessmentblock/staff_debug/student_info.html"
return path, context
开发者ID:hkawasaki,项目名称:edx-ora2,代码行数:50,代码来源:staff_info_mixin.py
示例11: test_clear_state
def test_clear_state(self):
# Create a submission, give it a score, and verify that score exists
submission = api.create_submission(STUDENT_ITEM, ANSWER_ONE)
api.set_score(submission["uuid"], 11, 12)
score = api.get_score(STUDENT_ITEM)
self._assert_score(score, 11, 12)
self.assertEqual(score['submission_uuid'], submission['uuid'])
# Reset the score with clear_state=True
# This should set the submission's score to None, and make it unavailable to get_submissions
api.reset_score(
STUDENT_ITEM["student_id"],
STUDENT_ITEM["course_id"],
STUDENT_ITEM["item_id"],
clear_state=True,
)
score = api.get_score(STUDENT_ITEM)
self.assertIsNone(score)
subs = api.get_submissions(STUDENT_ITEM)
self.assertEqual(subs, [])
开发者ID:edx,项目名称:edx-submissions,代码行数:20,代码来源:test_api.py
示例12: get_student_info_path_and_context
def get_student_info_path_and_context(self, student_username):
"""
Get the proper path and context for rendering the student info
section of the staff area.
Args:
student_username (unicode): The username of the student to report.
"""
# Import is placed here to avoid model import at project startup.
from submissions import api as submission_api
anonymous_user_id = None
student_item = None
submissions = None
submission = None
submission_uuid = None
if student_username:
anonymous_user_id = self.get_anonymous_user_id(student_username, self.course_id)
student_item = self.get_student_item_dict(anonymous_user_id=anonymous_user_id)
if anonymous_user_id:
# If there is a submission available for the requested student, present
# it. If not, there will be no other information to collect.
submissions = submission_api.get_submissions(student_item, 1)
if submissions:
submission = submissions[0]
submission_uuid = submission['uuid']
# This will add submission (which may be None) and username to the context.
context = self.get_student_submission_context(student_username, submission)
# Only add the rest of the details to the context if a submission exists.
if submission_uuid:
self.add_submission_context(submission_uuid, context)
path = 'openassessmentblock/staff_area/oa_student_info.html'
return path, context
开发者ID:openfun,项目名称:edx-ora2,代码行数:39,代码来源:staff_area_mixin.py
示例13: clear_student_state
def clear_student_state(self, *args, **kwargs):
# pylint: disable=unused-argument
"""
For a given user, clears submissions and uploaded files for this XBlock.
Staff users are able to delete a learner's state for a block in LMS. When that capability is
used, the block's "clear_student_state" function is called if it exists.
"""
student_id = kwargs['user_id']
for submission in submissions_api.get_submissions(
self.get_student_item_dict(student_id)
):
submission_file_sha1 = submission['answer'].get('sha1')
submission_filename = submission['answer'].get('filename')
submission_file_path = self.file_storage_path(submission_file_sha1, submission_filename)
if default_storage.exists(submission_file_path):
default_storage.delete(submission_file_path)
submissions_api.reset_score(
student_id,
self.block_course_id,
self.block_id,
clear_state=True
)
开发者ID:mitodl,项目名称:edx-sga,代码行数:23,代码来源:sga.py
示例14: test_set_attempt_number
def test_set_attempt_number(self):
api.create_submission(STUDENT_ITEM, ANSWER_ONE, None, 2)
submissions = api.get_submissions(STUDENT_ITEM)
student_item = self._get_student_item(STUDENT_ITEM)
self._assert_submission(submissions[0], ANSWER_ONE, student_item.pk, 2)
开发者ID:YoshidaKS,项目名称:edx-ora2,代码行数:5,代码来源:test_api.py
示例15: test_unicode_enforcement
def test_unicode_enforcement(self):
api.create_submission(STUDENT_ITEM, "Testing unicode answers.")
submissions = api.get_submissions(STUDENT_ITEM, 1)
self.assertEqual(u"Testing unicode answers.", submissions[0]["answer"])
开发者ID:YoshidaKS,项目名称:edx-ora2,代码行数:4,代码来源:test_api.py
示例16: test_various_student_items
def test_various_student_items(self, valid_student_item):
api.create_submission(valid_student_item, ANSWER_ONE)
student_item = self._get_student_item(valid_student_item)
submission = api.get_submissions(valid_student_item)[0]
self._assert_submission(submission, ANSWER_ONE, student_item.pk, 1)
开发者ID:YoshidaKS,项目名称:edx-ora2,代码行数:5,代码来源:test_api.py
示例17: get_student_info_path_and_context
def get_student_info_path_and_context(self, student_username):
"""
Get the proper path and context for rendering the the student info
section of the staff debug panel.
Args:
student_username (unicode): The username of the student to report.
"""
submission_uuid = None
submission = None
assessment_steps = self.assessment_steps
anonymous_user_id = None
submissions = None
student_item = None
if student_username:
anonymous_user_id = self.get_anonymous_user_id(student_username, self.course_id)
student_item = self.get_student_item_dict(anonymous_user_id=anonymous_user_id)
if anonymous_user_id:
# If there is a submission available for the requested student, present
# it. If not, there will be no other information to collect.
submissions = submission_api.get_submissions(student_item, 1)
if submissions:
submission_uuid = submissions[0]['uuid']
submission = submissions[0]
if 'file_key' in submission.get('answer', {}):
file_key = submission['answer']['file_key']
try:
submission['image_url'] = file_api.get_download_url(file_key)
except file_api.FileUploadError:
# Log the error, but do not prevent the rest of the student info
# from being displayed.
msg = (
u"Could not retrieve image URL for staff debug page. "
u"The student username is '{student_username}', and the file key is {file_key}"
).format(student_username=student_username, file_key=file_key)
logger.exception(msg)
example_based_assessment = None
self_assessment = None
peer_assessments = []
submitted_assessments = []
if "peer-assessment" in assessment_steps:
peer_assessments = peer_api.get_assessments(submission_uuid)
submitted_assessments = peer_api.get_submitted_assessments(submission_uuid, scored_only=False)
if "self-assessment" in assessment_steps:
self_assessment = self_api.get_assessment(submission_uuid)
if "example-based-assessment" in assessment_steps:
example_based_assessment = ai_api.get_latest_assessment(submission_uuid)
workflow_cancellation = workflow_api.get_assessment_workflow_cancellation(submission_uuid)
if workflow_cancellation:
workflow_cancellation['cancelled_by'] = self.get_username(workflow_cancellation['cancelled_by_id'])
context = {
'submission': submission,
'workflow_cancellation': workflow_cancellation,
'peer_assessments': peer_assessments,
'submitted_assessments': submitted_assessments,
'self_assessment': self_assessment,
'example_based_assessment': example_based_assessment,
'rubric_criteria': copy.deepcopy(self.rubric_criteria_with_labels),
}
if peer_assessments or self_assessment or example_based_assessment:
max_scores = peer_api.get_rubric_max_scores(submission_uuid)
for criterion in context["rubric_criteria"]:
criterion["total_value"] = max_scores[criterion["name"]]
path = 'openassessmentblock/staff_debug/student_info.html'
return path, context
开发者ID:kriwil,项目名称:edx-ora2,代码行数:79,代码来源:staff_info_mixin.py
示例18: get_student_info_path_and_context
def get_student_info_path_and_context(self, student_id):
"""
Get the proper path and context for rendering the the student info
section of the staff debug panel.
Args:
student_id (unicode): The ID of the student to report.
"""
submission_uuid = None
submission = None
assessment_steps = self.assessment_steps
student_item = self.get_student_item_dict()
scores = {}
problem_closed = None
if student_id:
student_item['student_id'] = student_id
# If there is a submission available for the requested student, present
# it. If not, there will be no other information to collect.
submissions = submission_api.get_submissions(student_item, 1)
if submissions:
submission_uuid = submissions[0]['uuid']
submission = submissions[0]
if 'file_key' in submission.get('answer', {}):
file_key = submission['answer']['file_key']
try:
submission['image_url'] = file_api.get_download_url(file_key)
except file_api.FileUploadError:
# Log the error, but do not prevent the rest of the student info
# from being displayed.
msg = (
u"Could not retrieve image URL for staff debug page. "
u"The student ID is '{student_id}', and the file key is {file_key}"
).format(student_id=student_id, file_key=file_key)
logger.exception(msg)
example_based_assessment = None
self_assessment = None
peer_assessments = []
submitted_assessments = []
if "peer-assessment" in assessment_steps:
peer_assessments = peer_api.get_assessments(submission_uuid)
submitted_assessments = peer_api.get_submitted_assessments(submission_uuid, scored_only=False)
# Get the data we need for instructor override of the student's score
rubric_dict = create_rubric_dict(self.prompt, self.rubric_criteria_with_labels)
scores = peer_api.get_data_for_override_score(
submission_uuid,
student_item,
rubric_dict,
)
problem_closed, dummy0, dummy1, dummy2 = self.is_closed(step='peer-assessment', course_staff=False)
if "self-assessment" in assessment_steps:
self_assessment = self_api.get_assessment(submission_uuid)
if "example-based-assessment" in assessment_steps:
example_based_assessment = ai_api.get_latest_assessment(submission_uuid)
context = {
'submission': submission,
'peer_assessments': peer_assessments,
'submitted_assessments': submitted_assessments,
'self_assessment': self_assessment,
'example_based_assessment': example_based_assessment,
'rubric_criteria': copy.deepcopy(self.rubric_criteria_with_labels),
'scores': scores,
'problem_closed': problem_closed,
}
if peer_assessments or self_assessment or example_based_assessment:
max_scores = peer_api.get_rubric_max_scores(submission_uuid)
for criterion in context["rubric_criteria"]:
criterion["total_value"] = max_scores[criterion["name"]]
path = 'openassessmentblock/staff_debug/student_info.html'
return path, context
开发者ID:robertgerinlajoie,项目名称:edx-ora2,代码行数:83,代码来源:staff_info_mixin.py
示例19: comment
def comment(self):
"""str: The staff comment."""
submissions = submissions_api.get_submissions(self.submission_id)
if submissions:
return submissions[0]['answer']['comment']
开发者ID:openfun,项目名称:edx-gea,代码行数:5,代码来源:gea_assessment.py
注:本文中的submissions.api.get_submissions函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论