Created
January 8, 2015 17:36
-
-
Save jongravois/93a21a833eb68bb70f80 to your computer and use it in GitHub Desktop.
calcGrade Function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function calcGrade(fins, grads){ | |
//console.log(fins); | |
//console.log(grads); | |
var grade = 'F'; | |
_(grads).find(function(grad) { | |
//debt to asset | |
if (grad.debt2asset >= fins.debt2asset_ratio_adj) { | |
return false; | |
} | |
//current ratio | |
if (grad.current_ratio <= fins.current_assets_adj) { | |
return false; | |
} | |
//working capital | |
if (grad.working_capital <= fins.capWork_adj) { | |
return false; | |
} | |
//borrowing capital | |
if (grad.borrowing_capacity <= fins.capBorrow_adj) { | |
return false; | |
} | |
//credit_score | |
if (grad.credit_score <= fins.credit_score) { | |
return false; | |
} | |
//experience | |
if (grad.years_farming < fins.experience) { | |
return false; | |
} | |
//cpa_financials | |
if (grad.cpa_financials !== fins.cpa_financials) { | |
return false; | |
} | |
//bankruptcy | |
if (grad.bankruptcy !== fins.bankruptcy) { | |
return false; | |
} | |
//judgements | |
if (grad.judgements !== fins.judgements) { | |
return false; | |
} | |
grade = grad.grade; | |
return true; | |
}); | |
return grade; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment