Skip to content

Commit

Permalink
fix collection preview to match order
Browse files Browse the repository at this point in the history
  • Loading branch information
zincarla committed Sep 28, 2021
1 parent 91c8c2b commit c9dd3c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions plugins/mariadbplugin/CollectionFunctions.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ func (DBConnection *MariaDBPlugin) GetCollections(PageStart uint64, PageStride u
) Counts ON Counts.CollectionID = CL.ID
-- This part gets a preview image location
LEFT JOIN (
SELECT Location, CollectionMembers.CollectionID as CollectionID, MIN(CollectionMembers.OrderWeight)
FROM Images
INNER JOIN CollectionMembers ON CollectionMembers.ImageID = Images.ID
GROUP BY CollectionMembers.CollectionID
SELECT CM.CollectionID as CollectionID, Images.Location as Location
FROM CollectionMembers as CM
INNER JOIN Images on Images.ID = CM.ImageID
WHERE OrderWeight = (SELECT MIN(OrderWeight) From CollectionMembers WHERE CollectionMembers.CollectionID = CM.CollectionID)
) Preview ON Preview.CollectionID = CL.ID
ORDER BY Name
LIMIT ? OFFSET ?;`
Expand Down
8 changes: 4 additions & 4 deletions plugins/mariadbplugin/CollectionSearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ func (DBConnection *MariaDBPlugin) SearchCollections(Tags []interfaces.TagInform
GROUP BY CollectionID
) Counts ON Counts.CollectionID = ID
LEFT JOIN (
SELECT Location, CollectionMembers.CollectionID as CollectionID, MIN(CollectionMembers.OrderWeight)
FROM Images
INNER JOIN CollectionMembers ON CollectionMembers.ImageID = Images.ID
GROUP BY CollectionMembers.CollectionID
SELECT CM.CollectionID as CollectionID, Images.Location as Location
FROM CollectionMembers as CM
INNER JOIN Images on Images.ID = CM.ImageID
WHERE OrderWeight = (SELECT MIN(OrderWeight) From CollectionMembers WHERE CollectionMembers.CollectionID = CM.CollectionID)
) Preview ON Preview.CollectionID = ID `

if len(IncludeTags) > 0 {
Expand Down

0 comments on commit c9dd3c7

Please sign in to comment.