PurplePen.Reports.MissingPunches C# (CSharp) Method

MissingPunches() private method

private MissingPunches ( EventDB eventDB, List unusedControls ) : List
eventDB EventDB
unusedControls List
return List
        List<MissingThing> MissingPunches(EventDB eventDB, List<Id<ControlPoint>> unusedControls)
        {
            List<MissingThing> missingPunches = new List<MissingThing>();

            bool anyPunches = false;    // Keep track if any controls have non-empty punch pattersn.
            foreach (Id<ControlPoint> controlId in eventDB.AllControlPointIds) {
                if (unusedControls.Contains(controlId))
                    continue;

                ControlPoint control = eventDB.GetControl(controlId);
                if (control.kind != ControlPointKind.Normal)
                    continue;

                if (control.punches == null || control.punches.IsEmpty)
                    missingPunches.Add(new MissingThing(controlId, ReportText.EventAudit_MissingPunch));
                else
                    anyPunches = true;
            }

            if (anyPunches) {
                missingPunches.Sort((thing1, thing2) => QueryEvent.CompareControlIds(eventDB, thing1.controlId, thing2.controlId));
                return missingPunches;
            }
            else {
                // No controls had punch patterns defined. This event clearly is not using punches.
                return new List<MissingThing>();
            }
        }