fixed query for pulling attendance figures