manager: allow more precise time check for partial bookings (#80046)
gitea/chrono/pipeline/head Build queued...
Details
gitea/chrono/pipeline/head Build queued...
Details
This commit is contained in:
parent
6b964d708b
commit
a70045ea5b
|
@ -597,8 +597,8 @@ class PartialBookingCheckForm(forms.ModelForm):
|
|||
model = Booking
|
||||
fields = ['user_check_start_time', 'user_check_end_time', 'user_was_present']
|
||||
widgets = {
|
||||
'user_check_start_time': widgets.TimeWidget(),
|
||||
'user_check_end_time': widgets.TimeWidget(),
|
||||
'user_check_start_time': widgets.TimeWidget(step=60),
|
||||
'user_check_end_time': widgets.TimeWidget(step=60),
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
|
@ -57,9 +57,10 @@ class TimeWidget(TimeInput):
|
|||
input_type = 'time'
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
step = kwargs.pop('step', 300) # 5 minutes by default
|
||||
kwargs['format'] = '%H:%M'
|
||||
super().__init__(**kwargs)
|
||||
self.attrs['step'] = '300' # 5 minutes
|
||||
self.attrs['step'] = step
|
||||
self.attrs['pattern'] = '[0-9]{2}:[0-9]{2}'
|
||||
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ def test_manager_partial_bookings_check(check_types, app, admin_user):
|
|||
('foo-reason', False, 'Foo reason'),
|
||||
]
|
||||
|
||||
resp.form['user_check_start_time'] = '11:00'
|
||||
resp.form['user_check_start_time'] = '11:01'
|
||||
resp.form['user_check_end_time'] = '13:15'
|
||||
resp.form['user_was_present'] = 'True'
|
||||
resp.form['presence_check_type'] = 'bar-reason'
|
||||
|
@ -201,9 +201,9 @@ def test_manager_partial_bookings_check(check_types, app, admin_user):
|
|||
assert len(resp.pyquery('.registrant--bar')) == 2
|
||||
assert len(resp.pyquery('.registrant--bar.booking')) == 1
|
||||
assert len(resp.pyquery('.registrant--bar.check.present')) == 1
|
||||
assert resp.pyquery('.registrant--bar.check time')[0].text == '11:00'
|
||||
assert resp.pyquery('.registrant--bar.check time')[0].text == '11:01'
|
||||
assert resp.pyquery('.registrant--bar.check time')[1].text == '13:15'
|
||||
assert resp.pyquery('.registrant--bar.check')[0].attrib['style'] == 'left: 30.77%; width: 17.31%;'
|
||||
assert resp.pyquery('.registrant--bar.check')[0].attrib['style'] == 'left: 30.9%; width: 17.18%;'
|
||||
assert resp.pyquery('.registrant--bar span').text() == 'Bar reason'
|
||||
|
||||
resp = resp.click('Jane Doe')
|
||||
|
|
Loading…
Reference in New Issue