To store the average of the overall ratings in critiques for a title, avg_rating is added to the CML application's title table. The alternative is to calculate this value every time the Search Results and Search Details pages of the Corporate Media Library application are displayed. Insert, delete, and update triggers on the Critique table calculate and update the value in the avg_rating column. Adding Triggers to the Critique Table describes the details of triggers on the Critique table.
The changed title table has this structure:
The avg_rating is the average of all the ratings for approved critiques (isApproved column is set to True) of a title. Modifying the Settings Table explains the role of the isApproved field in the Critique table. The data type is decimal, precision is 2, and scale is 1. Calculations are rounded to the nearest half, because the avg_rating is displayed as a star graphic and it is not possible to effectively show small increments of the graphic.