Giveth / liquidpledging

Liquid Pledging
GNU General Public License v3.0
66 stars 39 forks source link

LiquidPledgingBase: getProjectLevel() double check #48

Closed GriffGreen closed 6 years ago

GriffGreen commented 6 years ago

I am 80% sure this works, but i would like to confirm there are tests that prove it works as expected for the case that there is one parent project (that it returns 2)

it might need to be return getProjectLevel(parentNM+1);?

Just a check, I expect I am wrong as I am just a muggle playing around in a world of wizards.. but I'd hate to pull a Gun Sirir and see a potential bug but not the devs.

    function getProjectLevel(PledgeAdmin m) internal returns(uint) {
        assert(m.adminType == PledgeAdminType.Project);
        if (m.parentProject == 0) return(1);
        PledgeAdmin storage parentNM = findAdmin(m.parentProject);
        return getProjectLevel(parentNM);

I want to learn how to write tests one day.......... one day.....

ewingrj commented 6 years ago

nice catch