Exemplo n.º 1
0
def generate(request, course_id, problem_id):
    """ Submit 'generate_answers_distribution_report' task to celery.

    Args:
         course_id (str): The course id as string.
         problem_id (str): The problem id as string.

    Return:
         Redirect to Report Manager dashboard.
    """
    store = modulestore()
    course_key = get_course_key(course_id)
    problem = fetch_problem(store, course_key, problem_id)

    running_report_name = build_answers_distribution_report_name(problem)

    input_args = {'problem_id' : problem_id,
                  'running_report_name' : running_report_name}

    try:
        submit_generate_answers_distribution_report(request, course_key, input_args)
        return redirect('course-dashboard:reports-manager:dashboard', course_id)
    except AlreadyRunningError:
        messages.warning(request, _("A report on answers distribution is already running"))
        return redirect('course-dashboard:reports-manager:dashboard', course_id)
Exemplo n.º 2
0
 def test_build_answers_distribution_report_name(self):
     problem_name = u"Quizz trés fà  cile."
     problem = ItemFactory(parent=self.course,
                           category='problem',
                           display_name=problem_name)
     report_name = utils.build_answers_distribution_report_name(problem)
     assert report_name
Exemplo n.º 3
0
def generate(request, course_id, problem_id):
    """ Submit 'generate_answers_distribution_report' task to celery.

    Args:
         course_id (str): The course id as string.
         problem_id (str): The problem id as string.

    Return:
         Redirect to Report Manager dashboard.
    """
    store = modulestore()
    course_key = get_course_key(course_id)
    problem = fetch_problem(store, course_key, problem_id)

    running_report_name = build_answers_distribution_report_name(problem)

    input_args = {
        'problem_id': problem_id,
        'running_report_name': running_report_name
    }

    try:
        submit_generate_answers_distribution_report(request, course_key,
                                                    input_args)
        return redirect('course-dashboard:reports-manager:dashboard',
                        course_id)
    except AlreadyRunningError:
        messages.warning(
            request, _("A report on answers distribution is already running"))
        return redirect('course-dashboard:reports-manager:dashboard',
                        course_id)
Exemplo n.º 4
0
 def setUp(self):
     super(AnswersDistributionReportsTask, self).setUp()
     self._rm_tree()
     self.initialize_course()
     self.define_option_problem(problem_url_name=PROBLEM_URL_NAME)
     self.problem_module = self.store.get_item(self.problem_location(PROBLEM_URL_NAME))
     self.running_report_name = build_answers_distribution_report_name(self.problem_module)
     self.username = '******'
Exemplo n.º 5
0
    def setUp(self):
        from instructor_task.tests.test_tasks import PROBLEM_URL_NAME

        super(AnswersDistributionReportsTask, self).setUp()
        self._rm_tree()
        self.initialize_course()
        self.define_option_problem(problem_url_name=PROBLEM_URL_NAME)
        self.problem_module = self.store.get_item(self.problem_location(PROBLEM_URL_NAME,
                                                                        self.course.id))
        self.running_report_name = build_answers_distribution_report_name(self.problem_module)
        self.username = '******'