def get_and_send_best_note(klass): notes = klass.get_notes_near_current_location() if notes: note = notes[0] # send SMS re note resp = TwilioHelper.send_sms_for_note(note.get(Note.A_TEXT)) if resp: note[Note.A_DT_LAST_SENT] = datetime.datetime.now() Note.create_or_update_note(note)
def add_note(klass, lat, lon, text, max_distance_in_meters=None, resend_interval=None): doc = { Note.A_LAT:float(lat), Note.A_LON:float(lon), Note.A_TEXT:text } if max_distance_in_meters: doc[Note.A_REQ_MAX_DISTANCE] = float(max_distance_in_meters)/1000.0 if resend_interval: doc[Note.A_RESEND_INTERVAL] = resend_interval return Note.create_or_update_note(doc)
def add_note(klass, lat, lon, text, max_distance_in_meters=None, resend_interval=None): doc = { Note.A_LAT: float(lat), Note.A_LON: float(lon), Note.A_TEXT: text } if max_distance_in_meters: doc[Note. A_REQ_MAX_DISTANCE] = float(max_distance_in_meters) / 1000.0 if resend_interval: doc[Note.A_RESEND_INTERVAL] = resend_interval return Note.create_or_update_note(doc)