Packages GraphQL: Add file size count
The Package Details page displays the total size of the package in the header:
Currently, this is done by iterating over the full package file list and summing the sizes. This should not be the case, because with the paginated endpoint we may have incorrect data (plus we should not be forced to fetch all the files just to calculate the size)
After a quick discussion with @10io we agreed that there are a few ways forward:
- Store the package size in the model
- Add a sum column in the model
- Pluck out the size from all the package files and use it to calculate it on the go
A few constraints to keep in mind
- Not all the package managers have files
- Not all the package_files (especially the old ones) may have a size set in the db
Edited by Nicolò Maria Mezzopera