mirror of
https://github.com/bpatrik/pigallery2.git
synced 2025-04-15 11:56:50 +02:00
fixing preview manager ordering
This commit is contained in:
parent
6c6d77ad34
commit
b4df99b5ce
@ -24,16 +24,16 @@ export class PreviewManager implements IPreviewManager {
|
|||||||
for (const sort of Config.Server.Preview.Sorting) {
|
for (const sort of Config.Server.Preview.Sorting) {
|
||||||
switch (sort) {
|
switch (sort) {
|
||||||
case SortingMethods.descDate:
|
case SortingMethods.descDate:
|
||||||
query.addOrderBy('media.creationDate', 'DESC');
|
query.addOrderBy('media.metadata.creationDate', 'DESC');
|
||||||
break;
|
break;
|
||||||
case SortingMethods.ascDate:
|
case SortingMethods.ascDate:
|
||||||
query.addOrderBy('media.creationDate', 'ASC');
|
query.addOrderBy('media.metadata.creationDate', 'ASC');
|
||||||
break;
|
break;
|
||||||
case SortingMethods.descRating:
|
case SortingMethods.descRating:
|
||||||
query.addOrderBy('media.rating', 'DESC');
|
query.addOrderBy('media.metadata.rating', 'DESC');
|
||||||
break;
|
break;
|
||||||
case SortingMethods.ascRating:
|
case SortingMethods.ascRating:
|
||||||
query.addOrderBy('media.rating', 'ASC');
|
query.addOrderBy('media.metadata.rating', 'ASC');
|
||||||
break;
|
break;
|
||||||
case SortingMethods.descName:
|
case SortingMethods.descName:
|
||||||
query.addOrderBy('media.name', 'DESC');
|
query.addOrderBy('media.name', 'DESC');
|
||||||
|
@ -184,6 +184,8 @@ describe('PreviewManager', (sqlHelper: DBTestHelper) => {
|
|||||||
expect(Utils.clone(await pm.setAndGetPreviewForDirectory(subDir))).to.deep.equalInAnyOrder(previewifyMedia(pFaceLess));
|
expect(Utils.clone(await pm.setAndGetPreviewForDirectory(subDir))).to.deep.equalInAnyOrder(previewifyMedia(pFaceLess));
|
||||||
Config.Server.Preview.Sorting = [SortingMethods.descRating];
|
Config.Server.Preview.Sorting = [SortingMethods.descRating];
|
||||||
expect(Utils.clone(await pm.setAndGetPreviewForDirectory(dir))).to.deep.equalInAnyOrder(previewifyMedia(p4));
|
expect(Utils.clone(await pm.setAndGetPreviewForDirectory(dir))).to.deep.equalInAnyOrder(previewifyMedia(p4));
|
||||||
|
Config.Server.Preview.Sorting = [SortingMethods.descName];
|
||||||
|
expect(Utils.clone(await pm.setAndGetPreviewForDirectory(dir))).to.deep.equalInAnyOrder(previewifyMedia(v));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should get preview for directory', async () => {
|
it('should get preview for directory', async () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user