<commit_before>Match Timing Manager
====================

We first set everything in a callback, so that it is invoked only
after the loading of the DOM.

    $ ->

Input
-----

We require, for displaying match timing, only the current match and
the clock.

        inputStream = Bacon.combineTemplate
            clock: Clock
            currentMatch: CurrentMatch

Formatting
----------

Match timing format differs based on four match modes.

We treat them here separately, although publicised through one
function -- *formatMatchTime* -- which takes as its argument the
number of seconds from the scheduled start time to display (generally
this will be *currentTime* - *startTime*) and returns the formatted
string.

        formatMatchTime = (secondsSinceStart) ->

The first match mode is that of the swap time and initial preparation
for the match, where we simply display the string "upcoming".

            return 'upcoming' if secondsSinceStart < -30

The second mode is that for the 30 seconds before the start of the
match, where we display a countdown timer.

            return "#{-secondsSinceStart}s" if secondsSinceStart < 0

The third mode is that of the main sequence of the match, where we
display the time as M:SS. To do this, we exploit the *FormatDoubleDigit*
function from the *clock* module.

            if secondsSinceStart <= 180
                return Math.floor(secondsSinceStart / 60) +
                       ':' +
                       FormatDoubleDigit(secondsSinceStart % 60)
<commit_msg>Fix the display of match timings<commit_after>Match Timing Manager
====================

We first set everything in a callback, so that it is invoked only
after the loading of the DOM.

    $ ->

Input
-----

We require, for displaying match timing, only the current match and
the clock.

        inputStream = Bacon.combineTemplate
            clock: Clock
            currentMatch: CurrentMatch

Formatting
----------

Match timing format differs based on four match modes.

We treat them here separately, although publicised through one
function -- *formatMatchTime* -- which takes as its argument the
number of seconds from the scheduled start time to display (generally
this will be *currentTime* - *startTime*) and returns the formatted
string.

        formatMatchTime = (secondsSinceStart) ->

We floor the seconds since start for sensible display.

            secondsSinceStart = Math.floor secondsSinceStart

The first match mode is that of the swap time and initial preparation
for the match, where we simply display the string "upcoming".

            return 'upcoming' if secondsSinceStart < -30

The second mode is that for the 30 seconds before the start of the
match, where we display a countdown timer.

            return "#{-secondsSinceStart}s" if secondsSinceStart < 0

The third mode is that of the main sequence of the match, where we
display the time as M:SS. To do this, we exploit the *FormatDoubleDigit*
function from the *clock* module.

            if secondsSinceStart <= 180
                return Math.floor(secondsSinceStart / 60) +
                       ':' +
                       FormatDoubleDigit(secondsSinceStart % 60)

{'fraction_non_alphanumeric': 0.0706436420722135, 'fraction_numerical': 0.0075353218210361065, 'mean_word_length': 2.852478839177751, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3214190', 'n_tokens_mistral': 800, 'n_tokens_neox': 740, 'n_words': 387}