Skip to content

Commit

Permalink
Merge branch 'api/logging' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
tienne-B committed Feb 10, 2024
2 parents ef9acb4 + aba8f09 commit bea06c0
Show file tree
Hide file tree
Showing 22 changed files with 371 additions and 229 deletions.
26 changes: 13 additions & 13 deletions tabbycat/actionlog/management/commands/keytimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,35 +38,35 @@ def handle_tournament(self, tournament, **options):
queryset = round.actionlogentry_set.order_by('timestamp')

# Find the last adj save before venue allocation
venues_last_allocated = queryset.filter(type=ActionLogEntry.ACTION_TYPE_VENUES_AUTOALLOCATE).last()
adj_saves = queryset.filter(type=ActionLogEntry.ACTION_TYPE_ADJUDICATORS_SAVE)
venues_last_allocated = queryset.filter(type=ActionLogEntry.ActionType.VENUES_AUTOALLOCATE).last()
adj_saves = queryset.filter(type=ActionLogEntry.ActionType.ADJUDICATORS_SAVE)
if venues_last_allocated:
adj_saves = adj_saves.filter(timestamp__lte=venues_last_allocated.timestamp)
last_adj_save = adj_saves.last()

entries = [
queryset.filter(type=ActionLogEntry.ACTION_TYPE_DRAW_CREATE).first(),
queryset.filter(type=ActionLogEntry.ActionType.DRAW_CREATE).first(),
queryset.filter(type__in=[
ActionLogEntry.ACTION_TYPE_DEBATE_IMPORTANCE_EDIT,
ActionLogEntry.ACTION_TYPE_DEBATE_IMPORTANCE_AUTO,
ActionLogEntry.ActionType.DEBATE_IMPORTANCE_EDIT,
ActionLogEntry.ActionType.DEBATE_IMPORTANCE_AUTO,
]).first(),
queryset.filter(type__in=[
ActionLogEntry.ACTION_TYPE_ADJUDICATORS_AUTO,
ActionLogEntry.ACTION_TYPE_PREFORMED_PANELS_DEBATES_AUTO,
ActionLogEntry.ActionType.ADJUDICATORS_AUTO,
ActionLogEntry.ActionType.PREFORMED_PANELS_DEBATES_AUTO,
]).first(),
last_adj_save,
venues_last_allocated,
# "start at" times goes here
queryset.filter(type__in=[
ActionLogEntry.ACTION_TYPE_BALLOT_CREATE,
ActionLogEntry.ACTION_TYPE_BALLOT_SUBMIT,
ActionLogEntry.ActionType.BALLOT_CREATE,
ActionLogEntry.ActionType.BALLOT_SUBMIT,
]).first(),
queryset.filter(type=ActionLogEntry.ACTION_TYPE_BALLOT_CONFIRM).first(),
queryset.filter(type=ActionLogEntry.ActionType.BALLOT_CONFIRM).first(),
queryset.filter(type__in=[
ActionLogEntry.ACTION_TYPE_BALLOT_CREATE,
ActionLogEntry.ACTION_TYPE_BALLOT_SUBMIT,
ActionLogEntry.ActionType.BALLOT_CREATE,
ActionLogEntry.ActionType.BALLOT_SUBMIT,
]).last(),
queryset.filter(type=ActionLogEntry.ACTION_TYPE_BALLOT_CONFIRM).last(),
queryset.filter(type=ActionLogEntry.ActionType.BALLOT_CONFIRM).last(),
]
times = [timezone.localtime(entry.timestamp) if entry else None for entry in entries]
date = next((t for t in times[:5][::-1] if t is not None), None)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Generated by Django 4.1.7 on 2024-01-11 17:27

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("actionlog", "0012_auto_20200705_1317"),
]

operations = [
migrations.AddField(
model_name="actionlogentry",
name="agent",
field=models.CharField(
choices=[("a", "API"), ("w", "Web")],
default="w",
max_length=1,
verbose_name="agent",
),
),
migrations.AlterField(
model_name="actionlogentry",
name="type",
field=models.CharField(
choices=[
("br.aj.set", "Changed adjudicator breaking status"),
("aj.crea", "Created adjudicator"),
("aj.edit", "Edited adjudicator"),
("aj.note", "Set adjudicator note"),
("aa.auto", "Auto-allocated adjudicators"),
("aa.save", "Saved adjudicator allocation"),
("av.aj.save", "Edited adjudicators availability"),
("av.save", "Edited availability"),
("av.tm.save", "Edited teams availability"),
("av.ve.save", "Edited room availability"),
("ba.ckin", "Checked in ballot set"),
("ba.conf", "Confirmed ballot set"),
("ba.crea", "Created ballot set"),
("ba.disc", "Discarded ballot set"),
("ba.edit", "Edited ballot set"),
("ba.subm", "Submitted ballot set from the public form"),
("br.ca.edit", "Edited break categories"),
("br.del", "Deleted team break for category"),
("br.rm.edit", "Edited breaking team remarks"),
("br.el.edit", "Edited break eligibility"),
("br.gene", "Generated the team break for all categories"),
("br.gen1", "Generated the team break for one category"),
(
"br.upda",
"Edited breaking team remarks and updated all team breaks",
),
(
"br.upd1",
"Edited breaking team remarks and updated this team break",
),
("ch.aj.gene", "Generated check in identifiers for adjudicators"),
("ch.sp.gene", "Generated check in identifiers for speakers"),
("ch.ve.gene", "Generated check in identifiers for rooms"),
("ac.aa.edit", "Edited adjudicator-adjudicator conflicts"),
("ac.ai.edit", "Edited adjudicator-institution conflicts"),
("ac.at.edit", "Edited adjudicator-team conflicts"),
("ac.ti.edit", "Edited team-institution conflicts"),
("db.crea", "Created debate"),
("db.edit", "Edited debate"),
("db.im.auto", "Auto-prioritized debate importance"),
("db.im.edit", "Edited debate importance"),
("dv.save", "Saved divisions"),
("dr.conf", "Confirmed draw"),
("dr.crea", "Created draw"),
("dr.rege", "Regenerated draw"),
("dr.rele", "Released draw"),
("dr.unre", "Unreleased draw"),
("fq.crea", "Created feedback question"),
("fq.edit", "Edited feedback question"),
("fb.save", "Saved feedback"),
("fb.subm", "Submitted feedback from the public form"),
("in.crea", "Created institution"),
("in.edit", "Edited institution"),
("mu.save", "Saved a matchup manual edit"),
("mo.edit", "Added/edited motion"),
("mo.rele", "Released motions"),
("mo.unre", "Unreleased motions"),
("op.edit", "Edited tournament options"),
("pp.aj.auto", "Auto-allocated adjudicators to preformed panels"),
("pp.aj.edit", "Edited preformed panel adjudicator"),
("pp.crea", "Created preformed panels"),
("pp.db.auto", "Auto-allocated preformed panels to debates"),
("pp.del", "Deleted preformed panels"),
("pp.im.auto", "Auto-prioritized preformed panels"),
("pp.im.edit", "Edited preformed panel importance"),
("rd.adva", "Advanced the current round to"),
("rd.comp", "Marked round as completed"),
("rd.crea", "Created round"),
("rd.edit", "Edited round"),
("rd.st.set", "Set start time"),
("ms.save", "Saved the sides status of a matchup"),
("si.adju", "Imported adjudicators using the simple importer"),
("si.inst", "Imported institutions using the simple importer"),
("si.team", "Imported teams using the simple importer"),
("si.venu", "Imported rooms using the simple importer"),
("se.ca.edit", "Edited speaker categories"),
("sp.crea", "Created speaker"),
("sp.edit", "Edited speaker"),
("se.edit", "Edited speaker category eligibility"),
("te.crea", "Created team"),
("te.edit", "Edited team"),
("ts.edit", "Edited adjudicator base score"),
("to.crea", "Created tournament"),
("to.edit", "Edited tournament"),
("aj.sc.upda", "Updated adjudicator scores in bulk"),
("ur.inv", "Invited user to the instance"),
("ve.ca.edit", "Edited room categories"),
("ve.ca.crea", "Created room category"),
("ve.co.edit", "Edited room constraints"),
("ve.crea", "Created room"),
("ve.edit", "Edited room"),
("ve.auto", "Auto-allocated rooms"),
("ve.save", "Saved a room manual edit"),
],
max_length=10,
verbose_name="type",
),
),
]
Loading

0 comments on commit bea06c0

Please sign in to comment.