Skip to content

Commit 2c5c764

Browse files
TamaroWalterdlmsr
authored andcommitted
Reformat SQL string to be more readable
1 parent 1059c4e commit 2c5c764

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

lib_his.php

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,24 @@ function get_courses_by_veranstids($veranstids) {
147147
}
148148

149149
$veranstids_string = implode(',', $veranstids);
150-
$q = pg_query(
151-
$pgDB->connection,
152-
"SELECT veranstid, veranstnr, semester, semestertxt, veranstaltungsart, titel, urlveranst
153-
FROM " .
154-
HIS_VERANSTALTUNG . " as veranst where veranstid in (" . $veranstids_string .
155-
") AND " . "(CURRENT_DATE - CAST(veranst.zeitstempel AS date)) < " .
156-
get_config('local_lsf_unification', 'max_import_age') .
157-
"order by semester,titel;"
158-
);
150+
$max_age = get_config('local_lsf_unification', 'max_import_age');
151+
152+
$sql = "
153+
SELECT
154+
veranstid,
155+
veranstnr,
156+
semester,
157+
semestertxt,
158+
veranstaltungsart,
159+
titel,
160+
urlveranst
161+
FROM " . HIS_VERANSTALTUNG . " as veranst
162+
WHERE
163+
veranstid in ($veranstids_string)
164+
AND (CURRENT_DATE - CAST(veranst.zeitstempel AS date)) < $max_age
165+
ORDER BY semester, titel;";
166+
167+
$q = pg_query($pgDB->connection, $sql);
159168
$result_list = [];
160169
while ($course = pg_fetch_object($q)) {
161170
$result = new stdClass();

0 commit comments

Comments
 (0)