From 75a8f0ce503e6fa88b6df45adb6c19405d7e2083 Mon Sep 17 00:00:00 2001 From: "Christian T. Jacobs" Date: Sun, 25 Jun 2017 15:52:05 +0100 Subject: [PATCH] Duplicates are now defined by the CALL, QSO_DATE and TIME_ON fields. Didn't seem necessary to also consider FREQ and MODE. --- docs/source/record_management.rst | 3 +-- pyqso/log.py | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/source/record_management.rst b/docs/source/record_management.rst index 6ad7a15..7b86e8c 100644 --- a/docs/source/record_management.rst +++ b/docs/source/record_management.rst @@ -66,6 +66,5 @@ Removing duplicate records -------------------------- PyQSO can find and delete duplicate records in a log. A record is a -duplicate of another if its data in the Callsign, Date, Time, Frequency, -and Mode fields are the same. Click ``Remove Duplicate Records`` in the +duplicate of another if its data in the Callsign, Date, and Time fields are the same. Click ``Remove Duplicate Records`` in the ``Records`` menu. diff --git a/pyqso/log.py b/pyqso/log.py index 99f138b..4bb05d3 100644 --- a/pyqso/log.py +++ b/pyqso/log.py @@ -235,6 +235,7 @@ class Log(Gtk.ListStore): if(row_index in duplicates): # Is this a duplicate row? If so, delete it. self.delete_record(row_index, iter) removed += 1 + break iter = self.iter_next(iter) # Move on to the next row, until iter_next returns None. assert(removed == len(duplicates)) @@ -262,7 +263,7 @@ class Log(Gtk.ListStore): return success def get_duplicates(self): - """ Find the duplicates in the log, based on the CALL, QSO_DATE, TIME_ON, FREQ and MODE fields. + """ Find the duplicates in the log, based on the CALL, QSO_DATE, and TIME_ON fields. :returns: A list of row IDs corresponding to the duplicate records. :rtype: list @@ -274,7 +275,7 @@ class Log(Gtk.ListStore): c.execute( """SELECT rowid FROM %s WHERE rowid NOT IN ( - SELECT MIN(rowid) FROM %s GROUP BY call, qso_date, time_on, freq, mode + SELECT MIN(rowid) FROM %s GROUP BY call, qso_date, time_on )""" % (self.name, self.name)) result = c.fetchall() for rowid in result: