"""Count recorded sales in one named trace. Does not sleep or start threads.

 The ordered trace on the card prints 2, matching two record-sale rows. The field question uses the stale story instead. The file does not start threads.
"""
import csv


def sales(path, trace):
    total = 0
    with open(path, newline="") as handle:
        for row in csv.DictReader(handle):
            if row["trace"] == trace and row["action"] == "record sale":
                total += 1
    return total


if __name__ == "__main__":
    print("ordered", sales("race-timeline.csv", "ordered"))
