badge calculate