Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • The code current compares next or previous match based on current time against the match date.

    shortcodes.php….line 253

    if ( $time ) {
    if ( $time == ‘next’ )
    $search .= ” AND DATEDIFF(NOW(), date) <= 0″;
    elseif ( $time == ‘prev’ )
    $search .= ” AND DATEDIFF(NOW(), date) > 0″;
    }

    https://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_datediff

    DATEDIFF() returns expr1 – expr2 expressed as a value in days from one date to the othe

    The important point with this function is it evaluates the result in days not hours (not a faction of a day). So it takes 24 hours after the game has completed before it expires. It is the opposite for “prev”.

    An improved approach is the Mysql function.

    TIMESTAMPDIFF(HOUR, start_time, end_time)

    This will return the difference in hours. You can then compare this to a configurable buffer or threshold (maybe a better term) to include or exclude matches.

    Time=next also has an issue. It takes 24 hours after the previous match before it removes the previous match. Needs to have a configurable buffer (in hours) when the previous match is removed.

Viewing 2 replies - 1 through 2 (of 2 total)