From 94a689344419d2c38698c243d6e977b79fbda808 Mon Sep 17 00:00:00 2001 From: Artem Anufrij Date: Wed, 27 Sep 2023 21:44:58 +0200 Subject: [PATCH] code style --- services/database/albums.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/database/albums.js b/services/database/albums.js index 9f33e44..9fe2da7 100644 --- a/services/database/albums.js +++ b/services/database/albums.js @@ -318,8 +318,8 @@ exports.randomCovers = function (count, size, callback) { .find({ "covers.cover64": { $exists: true } }) .project({ "covers.cover64": true }) .toArray((err, result) => { - let res = []; if (result.length > count) { + let res = []; while (count-- > 0) { let rnd = randomNumber(0, result.length); res.push(result[rnd]);