Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account for duplicate file sizes and speed up channel list page loading #348

Merged
merged 4 commits into from
Jun 22, 2017

Conversation

jayoshih
Copy link
Contributor

No description provided.

if cached_data:
return cached_data
tree_id = self.main_tree.tree_id
files = File.objects.select_related('contentnode').select_related('assessment_item')\

This comment was marked as spam.

This comment was marked as spam.

tree_id = self.main_tree.tree_id
files = File.objects.select_related('contentnode').select_related('assessment_item')\
.filter(Q(contentnode__tree_id=tree_id) | Q(assessment_item__contentnode__tree_id=tree_id))\
.values('checksum', 'file_size').distinct().aggregate(resource_size=Sum('file_size'))

This comment was marked as spam.

@jonboiser
Copy link
Contributor

@jayoshih Could you give me some steps on how to test this?

@jayoshih
Copy link
Contributor Author

jayoshih commented Jun 22, 2017

@jonboiser If you upload a file multiple times, does it add the file size multiple times under the following locations?

Content items:
image

File uploader:
image

Publish Modal:
image

Import:
image

@jonboiser
Copy link
Contributor

Ok, tested it out on both modals, and it looks good.

@jonboiser jonboiser merged commit d3cbeb8 into learningequality:develop Jun 22, 2017
@jamalex
Copy link
Member

jamalex commented Jun 22, 2017

@jayoshih jayoshih deleted the files branch August 8, 2017 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants