@@ -11,6 +11,8 @@ import { ItemSoundbiteService } from '../item/itemSoundbite';
1111
1212const QUEUE_LIST_POSITION_INCREMENT = 0.00000001 ;
1313
14+ const epsilon = 1e-21 ;
15+
1416export const listResourceRelations = [
1517 'clip' , 'clip.item' , 'clip.item.item_about' , 'clip.item.item_enclosures' , 'clip.item.item_enclosures.item_enclosure_sources' , 'clip.item.item_images' , 'clip.item.channel' , 'clip.item.channel.channel_images' ,
1618 'item' , 'item.item_about' , 'item.item_enclosures' , 'item.item_enclosures.item_enclosure_sources' , 'item.item_images' , 'item.channel' , 'item.channel.channel_images' ,
@@ -71,7 +73,7 @@ export class QueueResourceService extends BaseManyService<QueueResource, 'queue'
7173 }
7274
7375 const options = {
74- where : { queue : { id : queue . id } , list_position : MoreThanOrEqual ( 0 ) as any } ,
76+ where : { queue : { id : queue . id } , list_position : Between ( - epsilon , epsilon ) as any } ,
7577 order : { list_position : 'ASC' as FindOptionsOrderValue } ,
7678 relations : listResourceRelations
7779 } ;
@@ -273,7 +275,6 @@ export class QueueResourceService extends BaseManyService<QueueResource, 'queue'
273275 const resource = await resourceService . getByIdText ( resource_id_text ) ;
274276 if ( ! resource ) throw new Error ( `${ resourceKey } not found.` ) ;
275277
276- const epsilon = 1e-21 ;
277278 const existingNowPlaying = await manager . findOne ( QueueResource , {
278279 where : { queue : { id : queue . id } , list_position : Between ( - epsilon , epsilon ) as any }
279280 } ) as any ;
0 commit comments