mirror of
				https://github.com/immich-app/immich.git
				synced 2025-11-04 03:39:37 -05:00 
			
		
		
		
	fix(server): random returning less than count assets (#4201)
This commit is contained in:
		
							parent
							
								
									25d1b3e1b1
								
							
						
					
					
						commit
						84e4c15ed5
					
				@ -435,7 +435,7 @@ export class AssetRepository implements IAssetRepository {
 | 
				
			|||||||
      `SELECT *
 | 
					      `SELECT *
 | 
				
			||||||
       FROM assets
 | 
					       FROM assets
 | 
				
			||||||
       WHERE "ownerId" = $1
 | 
					       WHERE "ownerId" = $1
 | 
				
			||||||
       OFFSET FLOOR(RANDOM() * (SELECT GREATEST(COUNT(*) - 1, 0) FROM ASSETS)) LIMIT $2`,
 | 
					       OFFSET FLOOR(RANDOM() * (SELECT GREATEST(COUNT(*) - $2, 0) FROM ASSETS)) LIMIT $2`,
 | 
				
			||||||
      [ownerId, count],
 | 
					      [ownerId, count],
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user