Skip to content

Commit

Permalink
Merge pull request #10 from DoodleyJC/dev
Browse files Browse the repository at this point in the history
added remove button to list of active players
  • Loading branch information
DoodleyJC authored Apr 4, 2024
2 parents 074df16 + 8562c9a commit e99a84c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion bluenps/src/app/home-page/home-page.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
</div>
</div>
<div class="container">
<li *ngFor="let player of data">
<li class="border" *ngFor="let player of data">
<div class="row">
<div class="col">{{player.name}}</div>
<div class="col">{{player.time}}</div>
<div class="col">{{player.court}}</div>
<div class="col"> <button type="button" class="btn btn-danger" (click) = "deletePlayer(player)">remove</button> </div>
</div>
</div>

Expand Down
8 changes: 8 additions & 0 deletions bluenps/src/app/home-page/home-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,13 @@ export class HomePageComponent implements OnInit {
)
this.refreshData();
}
deletePlayer(player: signup): void{
this.backendService.deleteData(player.name).subscribe(
{
next: (value) => {this.refreshData();},
error: (e) => {console.log("errordeleting:", e);this.refreshData();}
}
)
}

}
Binary file modified bluenpsbackend/court/__pycache__/views.cpython-312.pyc
Binary file not shown.
4 changes: 2 additions & 2 deletions bluenpsbackend/court/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ def deleteToday(request):
return badRequest()

nameQuery = request.headers["nameQuery"]
fullQuery = f"^{nameQuery}$"
todayData = CourtPresence.objects.filter(
time=datetime.today(),
name__regex= nameQuery
)
).filter(name__regex= f"{fullQuery}")
dataCopy = list(todayData.values())
todayData.delete()
r = JsonResponse(dataCopy, safe=False)
Expand Down
Binary file modified bluenpsbackend/db.sqlite3
Binary file not shown.

0 comments on commit e99a84c

Please sign in to comment.