Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Fixes #5184 - My shots fail if accessed with zero shots and no deviceIds
Browse files Browse the repository at this point in the history
  • Loading branch information
punamdahiya committed Nov 16, 2018
1 parent 03a4600 commit ca76999
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server/src/servershot.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,10 +499,11 @@ Shot.getShotsForDevice = function(backend, deviceId, accountId, searchQuery, pag
[deviceId, accountId]
).then(rows => {
deviceIds = rows.map(x => x.id);

}).then(() => {
if (!deviceIds.length) {
shotsPage.totalShots = 0;
return [{totalShots: 0}];
return [{totalshots: 0}];
}

let idNums, sql, args;
Expand Down Expand Up @@ -542,6 +543,9 @@ Shot.getShotsForDevice = function(backend, deviceId, accountId, searchQuery, pag
}).then(() => {
const offset = (pageNumber - 1) * SHOTS_PER_PAGE;
let sql, args, idNums;
if (!deviceIds.length) {
return [];
}

if (searchQuery) {
idNums = idParamPositions(4, deviceIds);
Expand Down

0 comments on commit ca76999

Please sign in to comment.