Repository: ucfopen/canvasapi

Issue:
quiz.get_all_quiz_submissions() Does not process all pages
# Describe the bug

quiz.get_all_quiz_submissions() only returns 10 submissions and does not handle multiple pages.

# To Reproduce

1) Create canvasapi client
2) Get a course
3) Get a quiz in that course that has more than 10 submissions
4) Call quiz.get_all_quiz_submissions() and you'll find that only 10 were returned

# Expected behavior

The page_size param should probably default to 100 and a pagination_list should be returned like other requests.

# Environment information (please complete the following information)

- Python version (`python --version`): 3.7.0
- CanvasAPI version (`pip show canvasapi`): 0.12.0

# Additional context

If the quiz is also an assignment, then assignment.get_submissions() works fine. However, if a quiz does not offer points then it is not also an assignment and you need to use quiz.get_all_quiz_submissions()

Discussion:

Patch:
diff --git a/AUTHORS.md b/AUTHORS.md
index dd778ee..b480295 100644
--- a/AUTHORS.md
+++ b/AUTHORS.md
@@ -36,6 +36,7 @@ Patches and Suggestions
 - Markus [@elec3647](https://github.com/elec3647)
 - Matthew Fedder [@matthewf-ucsd](https://github.com/matthewf-ucsd)
 - Michael Phelps [@nottheswimmer](https://github.com/nottheswimmer)
+- Mike Nahmias [@Mike-Nahmias](https://github.com/Mike-Nahmias)
 - Nathan Dabu [@nathaned](https://github.com/nathaned)
 - Petar Nikolovski [@petarGitNik](https://github.com/petarGitNik)
 - Philip Austin [@phaustin](https://github.com/phaustin)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index afe14ef..5276fe1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -24,9 +24,14 @@
 - Added [Code of Conduct](https://github.com/ucfopen/canvasapi/blob/develop/CODE_OF_CONDUCT.md)
 - Added CODEOWNERS file
 
+### Deprecation Warnings
+
+- `Quiz.get_all_quiz_submissions` is now deprecated. Use `Quiz.get_submissions` instead.
+
 ### Bugfixes
 
 - Fixed an issue where creating an external tool did not properly send parameters to Canvas. (Thanks, [@altgilbers](https://github.com/altgilbers))
+- Fixed an issue where getting Quiz Submissions would only return up to the first 10 results (Thanks,[@Mike-Nahmias](https://github.com/Mike-Nahmias))
 
 ## [0.12.0] - 2019-04-03
 
diff --git a/canvasapi/quiz.py b/canvasapi/quiz.py
index b8c84ce..9d8edaf 100644
--- a/canvasapi/quiz.py
+++ b/canvasapi/quiz.py
@@ -1,5 +1,7 @@
 from __future__ import absolute_import, division, print_function, unicode_literals
 
+import warnings
+
 from six import python_2_unicode_compatible
 
 from canvasapi.canvas_object import CanvasObject
@@ -243,22 +245,44 @@ class Quiz(CanvasObject):
         """
         Get a list of all submissions for this quiz.
 
+        .. warning::
+            .. deprecated:: 0.13.0
+                Use :func:`canvasapi.quiz.Quiz.get_submissions` instead.
+
         :calls: `GET /api/v1/courses/:course_id/quizzes/:quiz_id/submissions \
         <https://canvas.instructure.com/doc/api/quiz_submissions.html#method.quizzes/quiz_submissions_api.index>`_
 
         :rtype: list of :class:`canvasapi.quiz.QuizSubmission`
         """
-        response = self._requester.request(
+        warnings.warn(
+            "`get_all_quiz_submissions` is being deprecated and will be removed in a "
+            "future version. Use `get_submissions` instead",
+            DeprecationWarning
+        )
+
+        return self.get_submissions(**kwargs)
+
+    def get_submissions(self, **kwargs):
+        """
+        Get a list of all submissions for this quiz.
+
+        :calls: `GET /api/v1/courses/:course_id/quizzes/:quiz_id/submissions \
+        <https://canvas.instructure.com/doc/api/quiz_submissions.html#method.quizzes/quiz_submissions_api.index>`_
+
+        :rtype: :class:`canvasapi.paginated_list.PaginatedList` of
+            :class:`canvasapi.quiz.QuizSubmission`
+        """
+        return PaginatedList(
+            QuizSubmission,
+            self._requester,
             'GET',
             'courses/{}/quizzes/{}/submissions'.format(
                 self.course_id,
                 self.id
             ),
+            _root='quiz_submissions',
             _kwargs=combine_kwargs(**kwargs)
         )
-        submission_list = response.json()['quiz_submissions']
-
-        return [QuizSubmission(self._requester, submission) for submission in submission_list]
 
     def get_quiz_submission(self, quiz_submission, **kwargs):
         """
@@ -318,7 +342,7 @@ class Quiz(CanvasObject):
 class QuizSubmission(CanvasObject):
 
     def __str__(self):
-        return "{}-{}".format(self.quiz_id, self.user_id)
+        return "Quiz {} - User {} ({})".format(self.quiz_id, self.user_id, self.id)
 
     def complete(self, **kwargs):
         """


Test patch:
diff --git a/tests/test_quiz.py b/tests/test_quiz.py
index b78788f..67014e2 100644
--- a/tests/test_quiz.py
+++ b/tests/test_quiz.py
@@ -1,5 +1,6 @@
 from __future__ import absolute_import, division, print_function, unicode_literals
 import unittest
+import warnings
 
 import requests_mock
 from six import text_type
@@ -8,6 +9,7 @@ from canvasapi import Canvas
 from canvasapi.exceptions import RequiredFieldMissing
 from canvasapi.quiz import Quiz, QuizSubmission, QuizQuestion, QuizExtension
 from canvasapi.quiz_group import QuizGroup
+from canvasapi.paginated_list import PaginatedList
 from tests import settings
 from tests.util import register_uris
 
@@ -198,20 +200,49 @@ class TestQuiz(unittest.TestCase):
     # get_all_quiz_submissions()
     def test_get_all_quiz_submissions(self, m):
         register_uris({'quiz': ['get_all_quiz_submissions']}, m)
-        submission = self.quiz.get_all_quiz_submissions()
 
-        self.assertIsInstance(submission, list)
-        self.assertEqual(len(submission), 2)
+        with warnings.catch_warnings(record=True) as warning_list:
+            submissions = self.quiz.get_all_quiz_submissions()
 
-        self.assertIsInstance(submission[0], QuizSubmission)
-        self.assertEqual(submission[0].id, 1)
-        self.assertTrue(hasattr(submission[0], 'attempt'))
-        self.assertEqual(submission[0].attempt, 3)
+            self.assertIsInstance(submissions, PaginatedList)
 
-        self.assertIsInstance(submission[1], QuizSubmission)
-        self.assertEqual(submission[1].id, 2)
-        self.assertTrue(hasattr(submission[1], 'score'))
-        self.assertEqual(submission[1].score, 5)
+            submission_list = [sub for sub in submissions]
+
+            self.assertEqual(len(submission_list), 2)
+
+            self.assertIsInstance(submission_list[0], QuizSubmission)
+            self.assertEqual(submission_list[0].id, 1)
+            self.assertTrue(hasattr(submission_list[0], 'attempt'))
+            self.assertEqual(submission_list[0].attempt, 3)
+
+            self.assertIsInstance(submission_list[1], QuizSubmission)
+            self.assertEqual(submission_list[1].id, 2)
+            self.assertTrue(hasattr(submission_list[1], 'score'))
+            self.assertEqual(submission_list[1].score, 5)
+
+            self.assertEqual(len(warning_list), 1)
+            self.assertEqual(warning_list[-1].category, DeprecationWarning)
+
+    # get_submissions()
+    def test_get_submissions(self, m):
+        register_uris({'quiz': ['get_all_quiz_submissions']}, m)
+        submissions = self.quiz.get_submissions()
+
+        self.assertIsInstance(submissions, PaginatedList)
+
+        submission_list = [sub for sub in submissions]
+
+        self.assertEqual(len(submission_list), 2)
+
+        self.assertIsInstance(submission_list[0], QuizSubmission)
+        self.assertEqual(submission_list[0].id, 1)
+        self.assertTrue(hasattr(submission_list[0], 'attempt'))
+        self.assertEqual(submission_list[0].attempt, 3)
+
+        self.assertIsInstance(submission_list[1], QuizSubmission)
+        self.assertEqual(submission_list[1].id, 2)
+        self.assertTrue(hasattr(submission_list[1], 'score'))
+        self.assertEqual(submission_list[1].score, 5)
 
     # get_quiz_submission
     def test_get_quiz_submission(self, m):