backend rails for compare percentage