|
@@ -272,6 +272,7 @@ class App extends React.Component {
|
|
|
|
|
|
this.state.match.matches.forEach((match) => {
|
|
|
[match.Spieler1, match.Spieler2].forEach((matchPlayer) => {
|
|
|
+ const id = `${match.Konkurrenz}_${matchPlayer}`
|
|
|
if (matchPlayer) {
|
|
|
let foundPlayer = this.state.player.players.find((player) =>
|
|
|
(player.name === matchPlayer) & (player.Konkurrenz === match.Konkurrenz)
|
|
@@ -280,9 +281,18 @@ class App extends React.Component {
|
|
|
console.log('Debug payerlist:', foundPlayer, match)
|
|
|
throw Error('Match player not found in player list. This is an error!')
|
|
|
}
|
|
|
- if (!foundPlayer.BezahltAm) {
|
|
|
- foundPlayer.BezahltAm = match.Datum
|
|
|
- }
|
|
|
+ foundPlayer.Matches.push(match)
|
|
|
+ foundPlayer.Matches = foundPlayer.Matches.sort((a, b) => {
|
|
|
+ if (a.Datum.getTime() < b.Datum.getTime()) {
|
|
|
+ return -1
|
|
|
+ }
|
|
|
+ if (a.Datum.getTime() === b.Datum.getTime()) {
|
|
|
+ return 0
|
|
|
+ }
|
|
|
+ if (a.Datum.getTime() > b.Datum.getTime()) {
|
|
|
+ return 1
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
})
|
|
@@ -312,7 +322,7 @@ class App extends React.Component {
|
|
|
[],
|
|
|
[`${PLACES[place] || place}`, null, '50.- oder 30.- (Junioren Jg. 1999 oder jünger)'],
|
|
|
[],
|
|
|
- ['bezahlt', 'Kat.', 'Zeit', 'Name', 'Betrag bez.', 'Quittung']
|
|
|
+ ['Status', 'Kat.', 'Zeit', 'Name', 'Betrag bez.', 'Quittung']
|
|
|
]
|
|
|
|
|
|
// Per place
|
|
@@ -323,20 +333,18 @@ class App extends React.Component {
|
|
|
const player = this.state.player.players.find((player) =>
|
|
|
(player.Konkurrenz === match.Konkurrenz) & (player.name === matchPlayer)
|
|
|
)
|
|
|
- let paid = null
|
|
|
- if (player.BezahltAm < this.matchDate.value) {
|
|
|
- paid = date2s(player.BezahltAm)
|
|
|
- }
|
|
|
- if (player.Bezahlt) {
|
|
|
- paid = 'OK'
|
|
|
- }
|
|
|
+ console.log(player.name, player.Matches)
|
|
|
+ const matchesBeforeToday = player.Matches.filter(match => {
|
|
|
+ return (match.Datum.getDate() < (new Date(this.matchDate.value)).getTime()) && match.result && (match.result !== 'WO')
|
|
|
+ })
|
|
|
+ console.log(matchesBeforeToday)
|
|
|
let price
|
|
|
if (player.isDoubles) {
|
|
|
price = (player.isJunior ? 15 : 25) + (player.isJuniorDP ? 15 : 25)
|
|
|
} else {
|
|
|
price = player.isJunior ? 30 : 50
|
|
|
}
|
|
|
- payListPerPlace.push([ paid, match.Konkurrenz, time2s(match.Datum), `(${price}.-) ${matchPlayer}` ])
|
|
|
+ payListPerPlace.push([ player.Status, match.Konkurrenz, time2s(match.Datum), matchPlayer, price, null ])
|
|
|
}
|
|
|
})
|
|
|
})
|