Skip to content

Commit f9fa025

Browse files
committed
resolve yash comments on the PR
1 parent aba1579 commit f9fa025

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

utils/progresses.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,13 @@ const assertUserOrTaskExists = async (queryParams) => {
8383
*/
8484
const buildQueryToFetchDocs = (queryParams) => {
8585
const { type, userId, taskId } = queryParams;
86-
let query;
8786
if (type) {
88-
query = progressesCollection.where("type", "==", type);
87+
return progressesCollection.where("type", "==", type);
88+
} else if (userId) {
89+
return progressesCollection.where("type", "==", "user").where("userId", "==", userId);
8990
} else {
90-
if (userId) {
91-
query = progressesCollection.where("type", "==", "user").where("userId", "==", userId);
92-
} else if (taskId) {
93-
query = progressesCollection.where("type", "==", "task").where("taskId", "==", taskId);
94-
}
91+
return progressesCollection.where("type", "==", "task").where("taskId", "==", taskId);
9592
}
96-
return query;
9793
};
9894

9995
/**

0 commit comments

Comments
 (0)