refactor getCompletionScore in app.js use ternary expression