olivierfriard / BORIS

Behavioral Observation Research Interactive Software
http://www.boris.unito.it
GNU General Public License v3.0
175 stars 34 forks source link

Failure to set time interval for new observation #693

Open florianduclot opened 11 months ago

florianduclot commented 11 months ago

BORIS version: 8.22.6

Describe the bug In the "New observation" dialog window, clicking the "Limit observation to a time interval" checkbox triggers an error:

Traceback (most recent call last):
  File "/home/florian/Documents/Tools/boris/boris_py311_venv/lib64/python3.11/site-packages/boris/observation.py", line 358, in limit_time_interval
    time_interval_dialog.time_widget.set_time(0)
  File "/home/florian/Documents/Tools/boris/boris_py311_venv/lib64/python3.11/site-packages/boris/duration_widget.py", line 188, in set_time
    if new_time.is_nan():
       ^^^^^^^^^^^^^^^
AttributeError: 'int' object has no attribute 'is_nan'

To Reproduce Steps to reproduce the behavior:

  1. Go to 'New observation window'
  2. Click on 'Limit observation to a time interval'
  3. See error detailed above.

Expected behavior The Time Interval dialog window should display.

Desktop (please complete the following information):

BORIS version: 8.22.6
OS: Linux 6.6.3-1-default #1 SMP PREEMPT_DYNAMIC Wed Nov 29 05:06:07 UTC 2023 (d766c57)
CPU: x86_64 x86_64
Python 3.11.6 (64-bit)
Qt 5.15.2 - PyQt 5.15.10
2023-12-12 11:16

System info:
NAME="openSUSE Tumbleweed"
# VERSION="20231210"
ID="opensuse-tumbleweed"
ID_LIKE="opensuse suse"
VERSION_ID="20231210"
PRETTY_NAME="openSUSE Tumbleweed"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:tumbleweed:20231210"
BUG_REPORT_URL="https://bugzilla.opensuse.org"
SUPPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org"
DOCUMENTATION_URL="https://en.opensuse.org/Portal:Tumbleweed"
LOGO="distributor-logo-Tumbleweed"
Linux T14s 6.6.3-1-default #1 SMP PREEMPT_DYNAMIC Wed Nov 29 05:06:07 UTC 2023 (d766c57) x86_64 x86_64 x86_64 GNU/Linux
florianduclot commented 11 months ago

From what I can see, this may result from a change introduced in fc4dc557da0a91018466122443329d37f4a9787e

I'm not sure what the type of new_time was expected there, but I can bypass this check for int very crudly (see below) and I no longer have that error; I can thus set a time interval just fine:

    def set_time(self, new_time):
        if type(new_time) is not int and new_time.is_nan():
            return
olivierfriard commented 10 months ago

Hi, this issue should be fixed in v. 8.22.15 just released. Can you confirm this?