calculating rating