예제 #1
0
    def make( cls, activity, course=None, only_new=False, **kwargs ):
        """
        Returns a IContentRepository of the appropriate sort with all the
        relevant data loaded, processed, and stored as a dataframe on data
        kwags may contain
            download=True

        :param activity:
        :param course:
        :param only_new:
        :param kwargs:
        :return: IContentRepository
        """
        # Get the object which handles loading student data
        # The params will determine whether this is from file or download
        loader = LoaderFactory.make( is_quiz=activity.is_quiz_type, is_discussion=activity.is_discussion_type, combo=True, **kwargs)

        if activity.is_discussion_type:
            return cls._for_discussion_type_activity(activity, course, loader, **kwargs)

        if activity.is_quiz_type:
            # If uses a quiz report, downloads report and populates the
            # appropriate repository (QuizRepository or ReviewRepository)
            return cls._for_quiz_type_activity(activity, course, loader, **kwargs)

        return cls._for_assignment_type_activity(activity, course, loader, **kwargs)
예제 #2
0
    def test_make_file_all(self):
        download = False
        only_new = False

        # call
        result = LoaderFactory.make(download, only_new)

        # check
        self.assertEqual(result, AllQuizReportFileLoader)
예제 #3
0
    def test_make_download_new(self):
        download = True
        only_new = True

        # call
        result = LoaderFactory.make(download, only_new)

        # check
        self.assertEqual(result, NewQuizReportDownloadLoader)
예제 #4
0
 def test_returns_assignment_loader(self):
     r = LoaderFactory.make(is_quiz=False)
     self.assertEqual(r, AssignmentDownloadLoader,
                      "Returns the AssignmentDownloadLoader")
예제 #5
0
 def test_returns_discussion_file_loader(self):
     r = LoaderFactory.make(is_discussion=True, download=False)
     self.assertEqual(r, DiscussionFileLoader)
예제 #6
0
 def test_returns_discussion_download_loader(self):
     r = LoaderFactory.make(is_discussion=True)
     self.assertEqual(r, DiscussionDownloadLoader)