Fixed lunch break bugs

This commit is contained in:
Gabriella Azzopardi 2020-12-14 14:10:13 +00:00 committed by Philip James Elson
parent 6208777d05
commit f19127ad6c
5 changed files with 17 additions and 7 deletions

View file

@ -326,11 +326,12 @@ class FormData:
present_intervals.append((time / 60, finish / 60))
break
if leave_times[-1] <= time:
if leave_times[-1] < time:
leave_times.pop()
else:
new_time = leave_times.pop()
present_intervals.append((time / 60, min(new_time, finish) / 60))
if time / 60 != min(new_time, finish) / 60 :
present_intervals.append((time / 60, min(new_time, finish) / 60))
is_present = False
time = new_time

View file

@ -292,8 +292,8 @@ function validate_form(form) {
//Validate all lunch breaks
if (submit) {
$("input[required].lunch").each(function() {
if (!validateLunchBreak(this)) {
$("input[required].start_time[data-lunch-for]").each(function() {
if (!validateLunchBreak($(this).data('time-group'))) {
submit = false;
}
});

View file

@ -219,7 +219,7 @@
<b>Ventilation data:</b> <br>
<ul>
<li>Mechanical ventilation = the HVAC supply of fresh air. Check the flow rates with the concerned technical department.</li>
<li>Natural ventilation = the type of window opening. The opening distance is between the fixed frame and movable part when open (commonly used values are window opening between 0.6 and 0.15 m). In case of periodic opening, specify the duration (e.g. for 10 min) and frequency (e.g. every 60 min).</li>
<li>Natural ventilation = the type of window opening. The opening distance is between the fixed frame and movable part when open (commonly used values are window height of 1.6m and window opening between 0.15m and 0.6m). In case of periodic opening, specify the duration (e.g. for 10 min) and frequency (e.g. every 60 min).</li>
<li>HEPA filtration = the air flow of the device. The following values are based on the different fan velocities of a specific commercial device proposed by the HSE Unit:</li>
<ul>
<li>Level 6 (max) = 430 m<sup>3</sup>/h (noisy)</li>

View file

@ -107,11 +107,11 @@
Gym = For comparison only, all persons doing heavy physical exercise, breathing and not talking.
{% endif %}
</p></li>
<li><p class="data_text">Presence of exposed occupant(s):</p></li>
<li><p class="data_text">Exposed occupant(s) activity time:</p></li>
<ul>
<li><p class="data_subtext">Start time: {{ form.activity_start | minutes_to_time }} &nbsp&nbsp End time: {{ form.activity_finish | minutes_to_time }}</p></li>
</ul>
<li><p class="data_text">Presence of infected occupant(s):</p></li>
<li><p class="data_text">Infected occupant(s) activity time:</p></li>
<ul>
<li><p class="data_subtext">Start time: {{ form.infected_start | minutes_to_time }} &nbsp&nbsp End time: {{ form.infected_finish | minutes_to_time }}</p></li>
</ul>

View file

@ -161,6 +161,15 @@ def test_exposed_present_intervals(baseline_form):
correct = ((9, 10+37/60), (10+52/60, 12.5), (13.5, 15+7/60), (15+22/60, 17.0))
assert baseline_form.exposed_present_interval().present_times == correct
def test_exposed_present_intervals_starting_with_lunch(baseline_form):
baseline_form.coffee_breaks = 0
baseline_form.activity_start = baseline_form.lunch_start = 13 * 60
baseline_form.activity_finish = 18 * 60
baseline_form.lunch_finish = 14 * 60
baseline_form.infected_start = 9 * 60
baseline_form.infected_finish = 13 * 60
correct = ((14.0, 18.0),)
assert baseline_form.exposed_present_interval().present_times == correct
def test_coffee_lunch_breaks(baseline_form):
baseline_form.coffee_duration = 30