Skip to content

Commit

Permalink
Merge pull request #30 from zorgch/develop
Browse files Browse the repository at this point in the history
Events query to include ongoing and upcoming events
  • Loading branch information
oliveratgithub committed Oct 24, 2020
2 parents 96616f8 + 100ee34 commit 2f5a36f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion www/includes/events.inc.php
Expand Up @@ -115,6 +115,7 @@ static function getEvents($year) {
* @version 1.1
* @since 1.0 Method added
* @since 1.1 `17.04.2020` `IneX` SQL Slow-Query optimization
* @since 1.2 `24.10.2020` `IneX` Enhanced SQL-Query to not miss ongoing nor upcoming events
*
* @see /includes/smarty.fnc.php
* @global object $user Globales Class-Object mit den User-Methoden & Variablen
Expand All @@ -137,7 +138,8 @@ static function getNext()
LEFT JOIN comments c ON (c.board = "e" AND c.thread_id = e.id)
LEFT JOIN comments_unread cu ON (cu.user_id = '.$user_id.' AND cu.comment_id = c.id)
WHERE
e.enddate > NOW() AND e.startdate BETWEEN NOW() AND DATE_ADD(NOW(), INTERVAL 7 DAY)
e.enddate >= NOW() AND (e.startdate BETWEEN (NOW() - INTERVAL 7 DAY) AND NOW())
OR e.startdate BETWEEN NOW() AND (NOW() + INTERVAL 5 DAY)
GROUP by e.id
ORDER BY e.startdate ASC';
$result = $db->query($sql, __FILE__, __LINE__, __METHOD__);
Expand Down

0 comments on commit 2f5a36f

Please sign in to comment.