From 55c6be822dc9f8016e8d256717de30c2635a2b39 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Mon, 28 Jan 2019 22:46:14 -0500 Subject: [PATCH] afc_statistics: Add rejected note for declined submissions. --- tasks/afc_statistics.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tasks/afc_statistics.py b/tasks/afc_statistics.py index 989defb..ee0ebbb 100644 --- a/tasks/afc_statistics.py +++ b/tasks/afc_statistics.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2009-2017 Ben Kurtovic +# Copyright (C) 2009-2019 Ben Kurtovic # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -708,14 +708,25 @@ class AFCStatistics(Task): short: submission is less than a kilobyte in length resubmit: submission was resubmitted after a previous decline old: submission has not been touched in > 4 days + rejected: submission was rejected, a more severe form of declined blocked: submitter is currently blocked """ notes = "" - ignored_charts = [self.CHART_NONE, self.CHART_ACCEPT, self.CHART_DECLINE] + ignored_charts = [self.CHART_NONE, self.CHART_ACCEPT] if chart in ignored_charts: return notes + if chart == self.CHART_DECLINE: + # Decline is special, as only the rejected note is meaningful + code = mwparserfromhell.parse(content) + for tmpl in code.filter_templates(): + if tmpl.name.strip().lower() == "afc submission": + if tmpl.has("reject") and tmpl.get("reject").value: + notes += "|nj=1" # Submission was rejected + break + return notes + copyvios = self.config.tasks.get("afc_copyvios", {}) regex = r"\{\{s*" + copyvios.get("template", "AfC suspected copyvio") if re.search(regex, content):