Skip to content

Instantly share code, notes, and snippets.

@kingcoyote
Forked from dustinc/gist:3823882
Created October 2, 2012 23:13
Show Gist options
  • Save kingcoyote/3823899 to your computer and use it in GitHub Desktop.
Save kingcoyote/3823899 to your computer and use it in GitHub Desktop.
Teacher.virtual('highest_degree').get(function() {
var weights = {
'Doctorates' : 100,
'Masters' : 10,
'Bachelors' : 1
}
return this.education.degrees.sort(function(a, b) {
return weights[b.degree_type] - weights[a.degree_type];
})[0].degree_type;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment