def update_db(self): changes = "" values = [] for att in treatment_course.CURRTRT_ROOT_ATTS: if self.new_value(att) != self.orig_values[att]: changes += "%s%s=%%s ," % (att, self.suffix) values.append(self.new_value(att)) treatment_course.update_course( changes.rstrip(","), values, self.serialno, self.courseno)
def update_db(self): ''' apply any edits (should be called if self.exec_() == True) to merge 2 courses, all treatments have to be combined, and placed into the oldest course. the newestimates table has to have the coursenumber adjusted. NOTE - old tx_hashes will not longer be generatable by the TreatmentCourseClass ''' trtchanges = "" trtvalues = [] for trt_att in treatment_course.CURRTRT_ATTS: if trt_att == "courseno": continue value = self.merged_course.__dict__[trt_att] existing = self.tx_course2.__dict__[trt_att] if value != existing: trtchanges += '%s = %%s ,' % trt_att trtvalues.append(value) self.list_hashes() if treatment_course.update_course(trtchanges.rstrip(","), trtvalues, self.serialno, self.courseno2 ): treatment_course.update_estimate_courseno(self.courseno1, self.courseno2) treatment_course.delete_course(self.serialno, self.courseno1)
def update_db(self): ''' apply any edits (should be called if self.exec_() == True) to merge 2 courses, all treatments have to be combined, and placed into the oldest course. the newestimates table has to have the coursenumber adjusted. NOTE - old tx_hashes will not longer be generatable by the TreatmentCourseClass ''' trtchanges = "" trtvalues = [] for trt_att in treatment_course.CURRTRT_ATTS: if trt_att == "courseno": continue value = self.merged_course.__dict__[trt_att] existing = self.tx_course2.__dict__[trt_att] if value != existing: trtchanges += '%s = %%s ,' % trt_att trtvalues.append(value) self.list_hashes() if treatment_course.update_course(trtchanges.rstrip(","), trtvalues, self.serialno, self.courseno2): treatment_course.update_estimate_courseno(self.courseno1, self.courseno2) treatment_course.delete_course(self.serialno, self.courseno1)