Fix code to speed up query for workplan by test report.