GitHub PullRequestReviewCommentEvent at 2014-05-30 12:59:26
Repository: edx-ora2
Actor: wedaly
Payload: {"comment":{"url":"https://api.github.com/repos/edx/edx-ora2/pulls/comments/13227243","id":13227243,"diff_hunk":"@@ -296,6 +303,42 @@ def mark_complete_and_save(self):\n         self.completed_at = now()\n         self.save()\n \n+    @classmethod\n+    def get_incomplete_workflows(cls, course_id, item_id):\n+        \"\"\"\n+        Gets all incomplete grading workflows for a given course and item.\n+\n+        Args:\n+            course_id (unicode): Uniquely identifies the course\n+            item_id (unicode): The discriminator for the item we are looking for\n+\n+        Yields:\n+            All incomplete workflows for this item, as a delayed \"stream\"\n+\n+        Raises:\n+            DatabaseError\n+        \"\"\"\n+\n+        # Finds all of the uuid's for workflows contained within the query\n+        grade_qs = [wflow['uuid'] for wflow in cls.objects.filter(\n+            course_id=course_id, item_id=item_id, completed_at__isnull=True\n+        ).values('uuid')]\n+        total_results = len(grade_qs)\n+\n+        # Defines our loop variables\n+        number_yielded = 0\n+\n+        # Continues to generate output until all workflows in the queryset have been output\n+        while number_yielded < total_results:","path":"apps/openassessment/assessment/models/ai.py","position":44,"original_position":44,"commit_id":"6b05b99765e3c25ba6bc41e06ae300cbfe22d4e9","original_commit_id":"6b05b99765e3c25ba6bc41e06ae300cbfe22d4e9","user":{"login":"wedaly","id":2948394,"avatar_url":"https://avatars.githubusercontent.com/u/2948394?","gravatar_id":"44480ae60bb8231a1e95497a562aa0b7","url":"https://api.github.com/users/wedaly","html_url":"https://github.com/wedaly","followers_url":"https://api.github.com/users/wedaly/followers","following_url":"https://api.github.com/users/wedaly/following{/other_user}","gists_url":"https://api.github.com/users/wedaly/gists{/gist_id}","starred_url":"https://api.github.com/users/wedaly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wedaly/subscriptions","organizations_url":"https://api.github.com/users/wedaly/orgs","repos_url":"https://api.github.com/users/wedaly/repos","events_url":"https://api.github.com/users/wedaly/events{/privacy}","received_events_url":"https://api.github.com/users/wedaly/received_events","type":"User","site_admin":false},"body":"I think that you could simplify by iterating through the list of UUIDs directly:\r\n```\r\nfor workflow_uuid in grade_workflow_uuids:\r\n```","created_at":"2014-05-30T12:59:26Z","updated_at":"2014-05-30T12:59:26Z","html_url":"https://github.com/edx/edx-ora2/pull/370#discussion_r13227243","pull_request_url":"https://api.github.com/repos/edx/edx-ora2/pulls/370","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-ora2/pulls/comments/13227243"},"html":{"href":"https://github.com/edx/edx-ora2/pull/370#discussion_r13227243"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-ora2/pulls/370"}}}}