Refactored: DB queries from statistics#graph moved to controller