Skip to content

Commit 9a52ff4

Browse files
authored
Merge pull request #28 from ChemiKyle/fix_log_digest_edge_cases
Fix log digest edge cases
2 parents 3620bfa + 5cd9f78 commit 9a52ff4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

get-log-digest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
$results = $module->queryLogs("
2828
select MAX(log_id) as max, MIN(log_id) as min
2929
where external_module_id = ? and project_id = ?
30-
AND timestamp >= ? and timestamp < ?
30+
AND timestamp >= ? and timestamp < DATE_ADD(?, INTERVAL 1 DAY)
3131
", [$this_module_id, $module->getProjectId(), $start, $end]);
3232

3333
while($row = $results->fetch_assoc()){
@@ -36,6 +36,12 @@
3636
$end_log_id = $start_log_id - LOG_WINDOW_SIZE;
3737
}
3838

39+
// Prevent potential infinite loop if no log entries are found in provided time window
40+
if (is_null($start_log_id) || is_null($min_log_id)) {
41+
echo "No activity found in the provided time window, please expand your search.";
42+
exit();
43+
}
44+
3945
$message_subtrings = $digestLog::createLikeStatements();
4046

4147
// NOTE: probably don't need EM id or project_id

0 commit comments

Comments
 (0)