calculate ratings when loading database