improve code efficiency

Changed ‘Rating’ type declaration
Updated ‘testDatabase’