-
-
Notifications
You must be signed in to change notification settings - Fork 840
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
Show duration and filesize in results #1776
Show duration and filesize in results #1776
Conversation
I have finally spent some time working on this. The backend is complete. It refactors the way we perform The frontend has been adjusted slightly, but imo still needs a bit of work. I'm not yet convinced that - at least currently - having pagination at both the top and bottom is necessarily a good idea. At the top, it uses up quite a lot of vertical real estate. I particularly don't think that its useful (or aesthetically pleasing) to have the pagination statistics at both the top and the bottom. It looks pretty ordinary especially when there is a small amount of results: I don't have any decent prior art to work with - or UX principles - but these would be my suggestions:
|
This is freaking fantastic! Works great, I haven't noticed any performance issues even without the index I thought it needed. Makes it much easier to reason about the relative sizes of sections of a collection. About the UI concerns, I think they are perfect as-is. I find myself scrolling very often to the bottom of a page to check how many results were returned for a filter, and having it at the top is extremely convenient. You get used to it very quickly. Even with few results, I don't think it's cluttered having it duplicated on the page. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is all the things I can find from a quick glance.
I think it's pretty good.
pkg/image/query.go
Outdated
func QueryWithCount(qb Queryer, imageFilter *models.ImageFilterType, findFilter *models.FindFilterType) ([]*models.Image, int, error) { | ||
// this was moved from the queryBuilder code | ||
// left here so that calling functions can reference this instead | ||
result, err := qb.Query(QueryOptions(imageFilter, findFilter, true)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicking, but at this point, result
is really a request
.
Then you can have request.AddCount()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is incorrect - Query
returns an ImageQueryResult
which in this case will contain the ids only. The result is turned into Image
objects only with the Resolve
function. So not really a request. We want the ability to not resolve the images if we don't need to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In any case, this particular function is no longer necessary since I removed all reference to it and there are concise alternatives anyway.
pkg/image/query.go
Outdated
return nil, 0, err | ||
} | ||
|
||
images, err := result.Resolve() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And resolved here into a result
. An alternative implementation would return images inside a struct.
It's nitpicking though and I wouldn't let it hold back this patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know the code doesn't do this however.
|
||
finder ImageFinder | ||
images []*Image | ||
resolveErr error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would probably just call this err
. It's implicit it is for resolution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think renaming it to err
could imply that its the error for the query operation and not the resolve operation.
I can't approve my own PR, but |
Started getting the following issue since either yesterday or this morning. So I'm going through the newest additions to see what queried an aggregate value, and I believe it should be this feature. When I apply a filter to target a very limited subset of scenes/images, this error doesn't pop up, but when I leave it to my default filters (which are basically just a random that targets all my entries), this starts to happen. I don't know the concrete implementation to know if one unit of the size int should represent a byte, mb or something higher or smaller. Can't tell what extra information I should provide other than my library stats, so here you go. |
@Emilaia What platform are you running on? I'll try to reproduce this |
Running on a raspberry pi 4B, via docker (so linux/arm), using the latest stashapp/stash:development image. |
Can you post the results of |
Armv7l is 32bit, so int is 32bit on that platform. So the count doesn't fit when it is signed. It has to be an int64 to make sure stuff fits in it. The JSON will usually have a problem once get past 53bit integers, since that's the breakoff point for a float64: once you have a larger integer it is not float64-representable. |
And sizes are often stored in uint64 or the like. They can't be negative, so it's worth signifying this. |
Any number around 3 billion and change always tips me off to 32 bit problems. It's strange how the front page stats don't seem to have a problem. I'll put up a fix when I find the culprit |
Same issue was present in the main stats page |
You just saved me a few hours! |
@Emilaia I opened up a PR, #1895 with a proposed fix, but I don't have an RPI handy to test. Can you test and see if the problem is resolved? I've created a build for armv7, available at https://kermie.isinthe.house/stash-linux-arm32v7-statsfix |
Sorry, but I'm unaware as to how use this and docker/docker-compose, as I don't see a file extension attached to it, have only worked with tar files. |
It's a plain linux executable. Let me see if I can put together a docker build |
@Emilaia |
It leads me to a 404 |
Sorry, I thought it would upload a lot faster - should be all set now. |
Tested it on all the screens that I had the issues with before, no issues now. |
Fantastic! That PR will probably hit develop soon, and if you use the 'latest' branch, it will probably be sometime in November. |
Resolves #1775
This PR has some issues. Off the top of my head:
So that it will conditionally run the queries.