ingest_order: first setup

This commit is contained in:
Klaas van Schelven
2024-04-08 22:13:52 +02:00
parent 6d4b1beae4
commit 1b37298a95
13 changed files with 171 additions and 21 deletions

View File

@@ -138,6 +138,10 @@ class Event(models.Model):
calculated_type = models.CharField(max_length=255, blank=True, null=False, default="")
calculated_value = models.CharField(max_length=255, blank=True, null=False, default="")
# 1-based, because this is for human consumption only, and using 0-based internally when we don't actually do
# anything with this value other than showing it to humans is super-confusing. Sorry Dijkstra!
ingest_order = models.IntegerField(blank=False, null=False)
class Meta:
unique_together = (("project", "event_id"),)
# index_together = (("group_id", "datetime"),) TODO seriously think about indexes
@@ -154,7 +158,7 @@ class Event(models.Model):
return "/events/event/%s/download/" % self.id
@classmethod
def from_ingested(cls, ingested_event, issue, parsed_data, calculated_type, calculated_value):
def from_ingested(cls, ingested_event, ingest_order, issue, parsed_data, calculated_type, calculated_value):
# 'from_ingested' may be a bit of a misnomer... the full 'from_ingested' is done in 'digest_event' in the views.
# below at least puts the parsed_data in the right place, and does some of the basic object set up (FKs to other
# objects etc).
@@ -191,6 +195,7 @@ class Event(models.Model):
'calculated_type': calculated_type,
'calculated_value': calculated_value,
'ingest_order': ingest_order,
}
)
return event, created