playov2-js-utilities 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -76,10 +76,10 @@ const getUserAverageRatingForASport = (currentAvg, prevAvg) => {
76
76
  let latest25Avg = currentAvg ? currentAvg * Constants.RATINGS_WEIGHTAGE.new : 0;
77
77
  let oldAvg = prevAvg ? prevAvg * Constants.RATINGS_WEIGHTAGE.old : 0;
78
78
 
79
- // If for any reason any player doesn't have any old rating, send back current average with 100% weightage
80
- if (!prevAvg) {
79
+ // If for any reason any player doesn't have any old rating/ new rating, send back both ratings with 100% weightage (as one of them will be zero)
80
+ if (!prevAvg || !currentAvg) {
81
81
  latest25Avg = currentAvg;
82
- oldAvg = 0;
82
+ oldAvg = prevAvg;
83
83
  }
84
84
 
85
85
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playov2-js-utilities",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Private package for JS utility functions",
5
5
  "main": "index.js",
6
6
  "scripts": {