import { actions, reducer, state } from './state' import components from './components' import { normalize } from '../helpers.js' const filters = { all: players => players, } const selectors = {} /** Class representing a player */ class Player { /** * Create a player * A player data item in the Swisstennis PlayerList.xlsx file has the following columns * Konkurrenz | Anmeldedatum | Lizenznummer | Klub | Klub Name | Name | Vorname | Geburtsdatum | Adresse | c/o | PLZ | Ort | * Land | Tel P | Tel G | Mobile | Email | Klassierung | Klass. Wert | Gesetzte | Kommentar | Einschränkungen | Kommentar | * Lizenz Nr.Doppelpartner | Name Doppelpartner | Vorname Doppelpartner | Geburtsdatum Doppelpartner | Klassierung Doppelpartner | * Klass. Wert Doppelpartner | bestätigt | On-line Anmeldung | bezahlt */ constructor (data) { this.Konkurrenz = normalize(data[0]) this.Lizenz = normalize(data[2]) this.Name = normalize(data[5]) this.Vorname = normalize(data[6]) this.Geburtsdatum = data[7] this.Klassierung = normalize(data[17]) this.LizenzDP = normalize(data[23]) this.NameDP = normalize(data[24]) this.VornameDP = normalize(data[25]) this.GeburtsdatumDP = data[26] this.KlassierungDP = normalize(data[27]) this.Bestaetigt = data[29] 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.name = this.isDoubles ? `${this.Name} ${this.Vorname} / ${this.NameDP} ${this.VornameDP}` : `${this.Name} ${this.Vorname}` } } export default { Player, actions, components, filters, selectors, reducer, state }