コード例 #1
0
ファイル: api.py プロジェクト: muselesscreator/edx-ora2
def delete_shared_files_for_team(course_id, item_id, team_id):
    """
    Delete shared files for a team for this block
    """
    uploads = SharedFileUpload.by_team_course_item(team_id, course_id, item_id)

    for upload in uploads:
        remove_file(upload.file_key)
        upload.delete()
コード例 #2
0
 def shared_uploads_for_team_by_key(self):
     """
     Returns **and caches** all of the SharedFileUpload records
     for this student/course/item.
     """
     shared_uploads = SharedFileUpload.by_team_course_item(
         team_id=self.team_id,
         course_id=self.student_item_dict['course_id'],
         item_id=self.student_item_dict['item_id'],
     )
     return {
         shared_upload.file_key: shared_upload
         for shared_upload in shared_uploads
     }
コード例 #3
0
ファイル: api.py プロジェクト: sendr/edx-ora2
    def shared_uploads_for_team_by_key(self, team_id):
        """
        Returns **and caches** all of the SharedFileUpload records
        for this student/course/item and team.

        Realistically, only one team_id will ever be requested, but this is a simple enough pattern
        """
        if team_id not in self.shared_uploads_for_team_by_key_cache:
            shared_uploads = SharedFileUpload.by_team_course_item(
                team_id=team_id,
                course_id=self.student_item_dict['course_id'],
                item_id=self.student_item_dict['item_id'],
            )
            shared_uploads_for_team_by_key = {
                shared_upload.file_key: shared_upload for shared_upload in shared_uploads
            }
            self.shared_uploads_for_team_by_key_cache[team_id] = shared_uploads_for_team_by_key
        return self.shared_uploads_for_team_by_key_cache[team_id]