Skip to content

Commit 8ba06cf

Browse files
author
David Lenton
committed
Merged in bookmarked-top-level-program-subjects-not-returned (pull request auth0#24)
course_id set to integer before program query
2 parents 33cc52f + 0650ba7 commit 8ba06cf

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

models/program.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,8 @@ class Program {
879879
// Default to published subjects
880880
options.status_id =
881881
typeof options.status_id !== 'undefined' ? options.status_id : 3;
882+
options.course_id =
883+
typeof options.course_id !== 'undefined' ? parseInt(options.course_id) : null;
882884
// let query = 'SELECT `clcdc`.`subject`.`id` AS `id`, \
883885
// `clcdc`.`subject`.`title` AS `title`, \
884886
// `clcdc`.`subject`.`intro` AS `intro`, \
@@ -1067,8 +1069,10 @@ class Program {
10671069
params.push(options.course_id);
10681070
}
10691071
} else {
1070-
if (parseInt(options.course_id) !== 0)
1071-
query += 'AND `clcdc`.`module_subject`.`course_id` is null ';
1072+
if (!isNaN(options.course_id)) {
1073+
if (parseInt(options.course_id) !== 0)
1074+
query += 'AND `clcdc`.`module_subject`.`course_id` is null ';
1075+
}
10721076
}
10731077
if (options.appId) {
10741078
query +=

0 commit comments

Comments
 (0)