Skip to content

Commit

Permalink
minor fixes to sql coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
dionysius committed Feb 4, 2019
1 parent 75f8c24 commit 2eb67a6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions classes/question/bank/performances_column.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function get_extra_joins() {
WHERE qasd.name = '-submit'
AND sq.id = " . $this->studentquizid . "
AND sqa.userid = " . $this->currentuserid . "
AND qas.fraction is not null
AND qas.fraction IS NOT NULL
GROUP BY qa.questionid
) qasdmax ON qasd.id = qasdmax.maxqasdid
WHERE qasd.name = '-submit'
Expand All @@ -167,13 +167,13 @@ public function get_required_fields() {
if ($this->studentquiz->aggregated) {
return array('sp.attempts practice', 'sp.attempts AS myattempts',
"(
CASE WHEN sp.attempts is null
CASE WHEN sp.attempts IS NULL
THEN ''
ELSE CASE WHEN sp.lastanswercorrect = 1
THEN 'gradedright'
ELSE 'gradedwrong'
END
END
END
END
) AS mylastattempt");
} else {
return array('pr.practice', 'myatts.myattempts', 'mylatts.mylastattempt');
Expand Down
4 changes: 2 additions & 2 deletions classes/question/bank/question_bank_filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public function get_sql_filter($data) {
$params[$name] = "%$value%";
break;
case 1: // Does not contain.
$res = ' (searchtag = 0 or searchtag is null) ';
$res = ' (searchtag = 0 OR searchtag IS NULL) ';
$params[$name] = "%$value%";
break;
case 2: // Equal to.
Expand All @@ -239,7 +239,7 @@ public function get_sql_filter($data) {
$params[$name] = "%$value";
break;
case 5: // Empty.
$res = ' (tags = 0 or tags is null) ';
$res = ' (tags = 0 OR tags IS NULL) ';
$params[$name] = "-ignore-";
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion classes/question/bank/tag_column.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ protected function display_content($question, $rowclasses) {
* @return array sql query join additional
*/
public function get_extra_joins() {
$searchtag = ($this->tagfilteractive) ? "SUM(CASE WHEN t.name LIKE :searchtag then 1 else 0 end)" : "0";
$searchtag = ($this->tagfilteractive) ? "SUM(CASE WHEN t.name LIKE :searchtag THEN 1 ELSE 0 END)" : "0";
return array('tags' => "LEFT JOIN (
SELECT ti.itemid AS questionid, COUNT(*) AS tags, " . $searchtag . " AS searchtag
FROM {tag} t
Expand Down

0 comments on commit 2eb67a6

Please sign in to comment.