mbridak / not1mm

Not1MM != N1MM, An amateur radio contest logger for Linux.
GNU General Public License v3.0
105 stars 27 forks source link

bandmap.py now crashes on CTRL-G from main. #66

Closed mbridak closed 10 months ago

mbridak commented 10 months ago

Describe the bug

If you press CTRL-G in the main window to tell the bandmap to fetch the spot matching the supplied string. It will now fail.

To Reproduce

Start not1mm and pull up the bandmap. Enter your call in the bandmap. In the main not1mm window, type some characters in the callsign field and press CTRL-G.

Result

Traceback (most recent call last):
  File "/home/mbridak/Nextcloud/dev/not1mm/not1mm/bandmap.py", line 479, in watch_udp
    spot = self.spots.get_matching_spot(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mbridak/Nextcloud/dev/not1mm/not1mm/bandmap.py", line 281, in get_matching_spot
    self.cursor.execute(
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 0, and there are 39 supplied.

Expected

Not crashing would be very nice.

mbridak commented 10 months ago

The culprit:

self.cursor.execute(
            f"select * from spots where freq >= {start} ",
            f"and freq <= {end} and callsign like '%{dx}%';",
        )

It seems when trying to make the linter happy, we changed the simple long string into a tuple. We just need to remove the commas at the end of the f-strings.

self.cursor.execute(
            f"select * from spots where freq >= {start} "
            f"and freq <= {end} and callsign like '%{dx}%';"
        )

Voila...