Add setter for the rank propriety

Set the rank only if it doesn’t exceed the max rank.