Example #1
0
 def set_rate(self, r):
     try:
         r = float(r)
     except ValueError:
         fprintf('Rates must be provided in the form of a number.', 
             file=sys.stderr)
         sys.exit()
     self.rate = r
     db.update(lambda c: c.execute("""
         UPDATE invoice SET rate=? WHERE rowid=?
     """, (self.rate, self.rowid)))
Example #2
0
 def _timer_db_update(self):
     """ Set the timer on the database to match 
         the timer of this object
     """
     db.update(lambda c: c.execute("""
         UPDATE user SET timer_running=?, timer_start=?, timer_total=?
         WHERE rowid=?
     """, (int(self.timer_running), self.timer_start, 
           self.timer_total, self.rowid
         )
     ))
Example #3
0
 def test_update(self):
     invoice_id = db.insert_invoice('Cool Project', 20.0, 1.0)
     db.update(lambda c_: c_.execute('UPDATE invoice SET rate=? WHERE rowid=?', (40.0, invoice_id)))
     self.c.execute('SELECT * FROM invoice WHERE rowid=?', (invoice_id,))
     self.assertEqual(self.c.fetchall(), [('Cool Project', 40.0, 1.0)])
Example #4
0
 def set_active_invoice(self, rowid):
     self.active_invoice_rowid = rowid
     db.update(lambda c: c.execute("""
         UPDATE user SET active_invoice=? WHERE rowid=?
     """, (self.active_invoice_rowid, self.rowid)))
Example #5
0
 def set_rounding(self, r):
     self.rounding = r
     db.update(lambda c: c.execute("""
         UPDATE user SET rounding=? WHERE rowid=?
     """, (self.rounding, self.rowid)))
Example #6
0
 def set_rate(self, r):
     self.rate = r
     db.update(lambda c: c.execute("""
         UPDATE user SET rate=? WHERE rowid=?
     """, (self.rate, self.rowid)))