Explorar el Código

fixed age bug.

Tomislav Cvetic hace 7 años
padre
commit
97c86d4a8e
Se han modificado 1 ficheros con 7 adiciones y 3 borrados
  1. 7 3
      src/player/index.js

+ 7 - 3
src/player/index.js

@@ -71,9 +71,13 @@ class Player {
     this.Bezahlt = data[31]
     this.BezahltAm = null
     this.Matches = []
-    this.isDoubles = this.Konkurrenz.match(/DM.*|[MW]D.*/)
-    this.isJunior = (this.Geburtsdatum) ? this.Geburtsdatum.getTime() >= (new Date((new Date()).getFullYear() - 18, 11, 31, 23, 59, 59, 999)).getTime() : false
-    this.isJuniorDP = (this.isDoubles & !!this.GeburtsdatumDP) ? this.GeburtsdatumDP.getTime() >= (new Date((new Date()).getFullYear() - 18, 11, 31, 23, 59, 59, 999)).getTime() : false
+    this.isDoubles = !!this.Konkurrenz.match(/DM.*|[MW]D.*/)
+    this.isJunior = (this.Geburtsdatum) ? this.Geburtsdatum.getTime() >= (new Date((new Date()).getFullYear() - 19, 11, 31, 23, 59, 59, 999)).getTime() : false
+    //!this.Geburtsdatum || console.log('DEBUG player:', this.Name, this.Vorname, this.Geburtsdatum, (new Date((new Date()).getFullYear() - 19, 11, 31, 23, 59, 59, 999)), this.Geburtsdatum.getTime(), (new Date((new Date()).getFullYear() - 18, 11, 31, 23, 59, 59, 999)).getTime())
+    this.isJuniorDP = (this.isDoubles && this.GeburtsdatumDP) ? this.GeburtsdatumDP.getTime() >= (new Date((new Date()).getFullYear() - 19, 11, 31, 23, 59, 59, 999)).getTime() : false
+    //!this.GeburtsdatumDP || console.log('DEBUG playerDP:', this.NameDP, this.VornameDP, this.GeburtsdatumDP, (new Date((new Date()).getFullYear() - 19, 11, 31, 23, 59, 59, 999)), this.GeburtsdatumDP.getTime(), (new Date((new Date()).getFullYear() - 18, 11, 31, 23, 59, 59, 999)).getTime())
+    //!this.Geburtsdatum || this.Geburtsdatum.getFullYear() !== 1999 || console.log('DEBUG 99:', this.Name, this.Vorname)
+    //!this.GeburtsdatumDP || this.GeburtsdatumDP.getFullYear() !== 1999 || console.log('DEBUG 99DP:', this.NameDP, this.VornameDP)
     this.name = this.isDoubles ? `${this.Name} ${this.Vorname} / ${this.NameDP} ${this.VornameDP}` : `${this.Name} ${this.Vorname}`
     if (this.Mobile && this.Mobile.match(reMobile)) {
       this.phone = this.Mobile