Rendering function for total player points
Split code of getTotalPoints function into two steps: 


Save list of players into temp variable. If playerId is specified, then create array with only one element;
Call calculatePoints in a foreach.


Other suggestions: 


Put var before points variable in calculatePoints function to move it from global to local scope;
Rename getTotalPoints function to updateTotalPoints;
Depending on the rest of your code it may be possible to pass array of players into render function. And move playerId check out of it.