From: <jb...@us...> - 2010-11-24 02:51:37
|
Revision: 736 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=736&view=rev Author: jblance Date: 2010-11-24 02:51:29 +0000 (Wed, 24 Nov 2010) Log Message: ----------- Update DB check to ensure time == duration Modified Paths: -------------- pytrainer/trunk/pytrainer/lib/ddbb.py pytrainer/trunk/pytrainer/main.py Modified: pytrainer/trunk/pytrainer/lib/ddbb.py =================================================================== --- pytrainer/trunk/pytrainer/lib/ddbb.py 2010-11-24 02:31:49 UTC (rev 735) +++ pytrainer/trunk/pytrainer/lib/ddbb.py 2010-11-24 02:51:29 UTC (rev 736) @@ -363,17 +363,20 @@ only for empty durations and where time can be parsed as an int ''' logging.debug('--') - listOfRecords = self.select_dict("records",('id_record','time'), "duration is NULL") - logging.debug("Found %d records in DB without date_time_local field populated" % (len(listOfRecords) ) ) + #listOfRecords = self.select_dict("records",('id_record','time'), "duration is NULL") + #logging.debug("Found %d records in DB without date_time_local field populated" % (len(listOfRecords) ) ) + listOfRecords = self.select_dict("records",('id_record','time', 'duration')) + logging.debug("Found %d records in DB" % (len(listOfRecords) ) ) for record in listOfRecords: try: duration = int(record['time']) except Exception as e: logging.info( "Error parsing time (%s) as int for record_id: %s" % (record['time'], record['id_record'])) continue - logging.debug("setting record %s duration to %d" % (record['id_record'], duration)) - data = {'duration': duration} - self.update_dict("records",data ,"id_record = %d"%record['id_record']) + if duration != record['duration']: + logging.debug("setting record %s duration to %d" % (record['id_record'], duration)) + data = {'duration': duration} + self.update_dict("records",data ,"id_record = %d"%record['id_record']) def populate_date_time_local(self): ''' Populate date_time_local and date from date_time_utc Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2010-11-24 02:31:49 UTC (rev 735) +++ pytrainer/trunk/pytrainer/main.py 2010-11-24 02:51:29 UTC (rev 736) @@ -53,7 +53,7 @@ class pyTrainer: def __init__(self,filename = None, data_path = None): #Version constants - self.version ="1.7.2_svn#735" + self.version ="1.7.2_svn#736" self.DB_version = 6 #Process command line options self.startup_options = self.get_options() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |