Removes triggered from to_json

Triggered has been deatached from the appointment having it's own entry into the db, so not part of the appointment data anymore
This commit is contained in:
Sergi Delgado Segura
2020-01-09 18:13:24 +01:00
parent 49657ccbfc
commit 15f9a9efe1

View File

@@ -81,28 +81,18 @@ class Appointment:
return appointment return appointment
def to_json(self, triggered=False): def to_json(self):
""" """
Exports an appointment as a deterministic json encoded string. Exports an appointment as a deterministic json encoded string.
This method ensures that multiple invocations with the same data yield the same value. This is the format used This method ensures that multiple invocations with the same data yield the same value. This is the format used
to store appointments in the database. to store appointments in the database.
Args:
triggered (:mod:`bool`): Whether the dispute has been triggered or not. When an appointment passes from the
:mod:`Watcher <pisa.watcher>` to the :mod:`Responder <pisa.responder>` it is not deleted straightaway.
Instead, the appointment is stored in the DB flagged as ``triggered``. This aims to ease handling block
reorgs in the future.
Returns: Returns:
:obj:`str`: A json-encoded str representing the appointment. :obj:`str`: A json-encoded str representing the appointment.
""" """
appointment = self.to_dict() return json.dumps(self.to_dict(), sort_keys=True, separators=(",", ":"))
appointment["triggered"] = triggered
return json.dumps(appointment, sort_keys=True, separators=(",", ":"))
def serialize(self): def serialize(self):
""" """