Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New probabilities endpoint #18

Open
wants to merge 88 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
21f7e74
Initial work on adding commands for recalculating statistics
thordy Mar 10, 2022
eaf7680
Added commands for recalculating all statistics
thordy Mar 13, 2022
8b897cb
Simplified recalculate statistics commands
thordy Mar 13, 2022
f6f67f7
New command for recreating elo
thordy Mar 13, 2022
a6028ca
Initial work on commands for recalculating elo
thordy Mar 13, 2022
59f02ee
Merge branch 'develop' into feature/commands
thordy Mar 29, 2022
799c4cd
Initial work on import command
thordy Mar 31, 2022
018c0f9
Merge branch 'develop' of github.com:kcapp/api into feature/commands
thordy May 18, 2022
bc147fe
Introducing a lower kfactor to Elo calculation
thordy May 26, 2022
ed7b100
Merge branch 'develop' of github.com:kcapp/api into feature/commands
thordy Jun 1, 2022
5d2300d
Merge branch 'develop' of github.com:kcapp/api into feature/commands
thordy Jun 1, 2022
fb3dec8
Merge branch 'develop' of github.com:kcapp/api into feature/commands
thordy Jun 8, 2022
d58cda6
Merge branch 'develop' of github.com:kcapp/api into feature/commands
thordy Dec 17, 2022
62759ce
Initial work on tournament preset
thordy Mar 5, 2023
631dbe1
Merge tag 'v2.5.0' into develop
thordy Mar 10, 2023
3eeb235
Initial files for next version
thordy Mar 10, 2023
0295f46
Merge branch 'develop' into feature/commands
thordy Mar 10, 2023
5a84c63
Added command for recalculating scam
thordy Mar 10, 2023
4024706
Updated changelog
thordy Apr 5, 2023
23aef6d
Initial files for next version
thordy May 11, 2023
28b0604
Correctly set First 9 Avg if leg was won in <9 darts
thordy May 11, 2023
1364959
Return all 9 dart shootout legs when getting statistics
thordy Jun 7, 2023
a5b86b7
Prepare for release of v2.6.0
thordy Jun 30, 2023
5410ff8
Merge branch 'release/2.6.0' into develop
thordy Jun 30, 2023
3a902a6
Initial files for next version
thordy Jun 30, 2023
1bcf4ff
Merge branch 'develop' of github.com:kcapp/api into feature/commands
thordy Jun 30, 2023
270d6ba
Correctly handle recalculation of statistics for all time with MySQL8
thordy Jun 30, 2023
61d34fc
Merge branch 'feature/commands' into develop
thordy Jul 1, 2023
238c6f7
Explicitly write checkout value for x01, and improved a lot of queries
thordy Jul 1, 2023
4fb0af5
Updated changelog
thordy Jul 1, 2023
37c34c5
Only return x01 legs when requesting random legs for players
thordy Jul 3, 2023
01c0f76
New endpoint for getting player hits
thordy Jul 11, 2023
70595ed
Initial work to support ANY/MASTER out for X01
thordy Jul 17, 2023
c6560ec
Correctly handle Master outshot
thordy Jul 17, 2023
8118014
Merge branch 'develop' of github.com:kcapp/api into feature/tournamen…
thordy Jul 31, 2023
a30ec2c
Updated tournament generation
thordy Aug 2, 2023
0ff93da
Initial backend support for badges
thordy Aug 6, 2023
51a1c4f
Added tournament groups to tournament preset
thordy Aug 6, 2023
1363339
Continued work on tournament presets
thordy Aug 7, 2023
a670537
Continued work on tournament presets
thordy Aug 11, 2023
409b725
Added support for tournament presets
thordy Aug 13, 2023
cd1bcf5
Merge branch 'feature/tournament_preset' into develop
thordy Aug 13, 2023
9240040
Added back match_presets deleted by accident
thordy Aug 13, 2023
74cff25
Correctly supporting single group in tournament preset
thordy Aug 17, 2023
630134b
Merge branch 'develop' of github.com:kcapp/api into feature/badges
thordy Aug 17, 2023
d3f5f66
Initial work on badges
thordy Aug 26, 2023
8c98792
Added option to add player to tournament
thordy Aug 29, 2023
b8ce9a3
Don't return bye matches to match list
thordy Sep 5, 2023
839d66f
Merge branch 'develop' of github.com:kcapp/api into feature/badges
thordy Sep 5, 2023
2fdb70a
Initial version of badges
thordy Sep 12, 2023
644d044
Separated commands for recalculating leg and global badges
thordy Sep 12, 2023
25eac66
Merge branch 'feature/badges' into develop
thordy Sep 12, 2023
554c613
Prepare for release of v2.7.0
thordy Sep 12, 2023
92c58fc
Correctly grant badges based on winner ID
thordy Sep 12, 2023
58f0867
Merge branch 'release/2.7.0' into develop
thordy Sep 12, 2023
51ae83e
Calculate high scores and badge high scores in the same way
thordy Sep 13, 2023
3af2d3a
Initial files for next version
thordy Sep 14, 2023
132529a
Endpoints for getting badge statistics
thordy Oct 4, 2023
8f43dee
Initial work to add additional badges
thordy Oct 9, 2023
e85921a
Added new DPL statistic
thordy Oct 10, 2023
f23d20f
Fixed Little Fish badge validation
thordy Oct 10, 2023
b698d94
Fixed DPL statistics with walkover legs
thordy Oct 10, 2023
8ad1ed7
New endpoints for getting a single badge
thordy Oct 14, 2023
11444d7
Initial work on 170 type
thordy Oct 27, 2023
77b35b8
Use tournament elo if available for odds
thordy Oct 31, 2023
6a307e4
Merge branch 'develop' of github.com:kcapp/api into feature/170
thordy Oct 31, 2023
db3bc8d
Fixed getting X01 History
thordy Feb 14, 2024
6bda0a1
Merge branch 'develop' of github.com:kcapp/api into feature/170
thordy Feb 14, 2024
29c437c
Removed accidental match type
thordy Feb 14, 2024
8739a00
Merge branch 'develop' of github.com:kcapp/api into feature/170
thordy Feb 14, 2024
84d7e1d
Added additional badges
thordy Mar 5, 2024
c6d080f
Fixed build of goose in Dockerfile
thordy Mar 5, 2024
25da812
Correctly only calculate shanghai during X01 matches for Badges
thordy Mar 8, 2024
4613280
Fixed bug preventing statistics to load when no legs exist
thordy Mar 8, 2024
76f32f0
Update all users without office when creating first office
thordy Mar 8, 2024
bcbbdfb
Added new 170 game type
thordy Mar 16, 2024
9c2d750
Merge branch 'feature/170' into develop
thordy Mar 16, 2024
759ba1e
Changed Around The World and Shanghai to use multiplier as points
thordy Mar 18, 2024
409e4f8
Count badges for all leg types
thordy Mar 28, 2024
2fb2d51
Removed debug logging from Zebra badge
thordy Mar 28, 2024
f5fcd6d
Correctly calculate match badges on match finish
thordy May 16, 2024
7c7845e
Added WLED support to venues
thordy Jun 13, 2024
3c74a5f
Add option to select TTS voice per venue
thordy Aug 16, 2024
c62967b
Updated players without office when first one is created
thordy Nov 13, 2024
0242f51
Correctly calculate scores for 170
thordy Nov 13, 2024
e9f8981
Fixed broken venue create
thordy Nov 13, 2024
fe7a58d
Fixed query for calculating highest checkout
thordy Nov 18, 2024
e0dd717
Fix calculation of matches_won
oveaurs Nov 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,8 @@ config/config*.yaml
log/
logs/

# Import/export files
*.csv

api
kcapp-api
42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
# Changelog

## [2.8.0] - TBD
#### Feature
- New game type `170`
- Endpoint for getting badge statistics
- Added Darts Per Leg `DPL` metric to tournament
- Count badges for all leg types
- WLED support for venues
- TTS voice selection per venue
- Lots of new badges

#### Changed
- Sort tournament best statistics by leg id for equal values
- Use tournament elo if available for odds
- Switched `Around the World` and `Shanghai` to count multiplers as points instead of value

#### Fixed
- Return `outshot_type` for `X01 Handicap`
- Correctly calculate match badges on match finish

## [2.7.0] - 2023-09-12
#### Feature
- Player Badges!
- Support for Tournament Presets
- Added commands for recalculating statistics, resetting elo etc
- New endpoint for getting player hits
- Support for `ANY` and `MASTER` out for `x01` legs

#### Changed
- Store `checkout` value for each `x01` leg explicitly
- Improved a lot of queries when loading player statistics to reduce load times by ~70% for players with a lot of data

#### Fixed
- Only return `x01` legs when requesting a random leg for a player

## [2.6.0] - 2023-06-30
#### Fixed
- Correctly set First 9 Avg. if leg was won in <9 darts
- Return statistics about all `9 Dart Shootout` legs on player statistics

## [2.5.0] - 2023-03-10
#### Feature
- Insert BotConfig on next Leg
Expand Down Expand Up @@ -120,6 +159,9 @@
#### Feature
- Intial version of API for [kcapp-frontend](https://github.com/kcapp/frontend)

[2.8.0]: https://github.com/kcapp/api/compare/v2.7.0...develop
[2.7.0]: https://github.com/kcapp/api/compare/v2.6.0...v2.7.0
[2.6.0]: https://github.com/kcapp/api/compare/v2.5.0...v2.6.0
[2.5.0]: https://github.com/kcapp/api/compare/v2.4.0...v2.5.0
[2.4.0]: https://github.com/kcapp/api/compare/v2.3.0...v2.4.0
[2.3.0]: https://github.com/kcapp/api/compare/v2.2.0...v2.3.0
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN apk update && apk add --no-cache git gcc
WORKDIR $GOPATH/src/github.com/pressly/goose
RUN git clone https://github.com/pressly/goose .
RUN go get -d -v
RUN CGO_ENABLED=0 go build -tags='no_postgres no_sqlite3' -o $GOPATH/bin/goose -a -ldflags '-extldflags "-static"' ./cmd/goose
RUN CGO_ENABLED=0 go build -tags='no_postgres no_sqlite3 no_ydb no_duckdb' -o $GOPATH/bin/goose -a -ldflags '-extldflags "-static"' ./cmd/goose

# Add script to run migrations
RUN mkdir -p /usr/local/scripts
Expand Down
23 changes: 23 additions & 0 deletions cmd/aroundtheclock.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package cmd

import (
"github.com/kcapp/api/data"
"github.com/kcapp/api/models"
"github.com/spf13/cobra"
)

// aroundtheclockCmd represents the aroundtheclock command
var aroundtheclockCmd = &cobra.Command{
Use: "aroundtheclock",
Short: "Recalculate Around the Clock statistics",
Run: func(cmd *cobra.Command, args []string) {
err := data.RecalculateStatistics(models.AROUNDTHECLOCK, legID, since, dryRun)
if err != nil {
panic(err)
}
},
}

func init() {
recalculateStatisticsCmd.AddCommand(aroundtheclockCmd)
}
23 changes: 23 additions & 0 deletions cmd/aroundtheworld.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package cmd

import (
"github.com/kcapp/api/data"
"github.com/kcapp/api/models"
"github.com/spf13/cobra"
)

// aroundtheworldCmd represents the aroundtheworld command
var aroundtheworldCmd = &cobra.Command{
Use: "aroundtheworld",
Short: "Recalculate Around the World statistics",
Run: func(cmd *cobra.Command, args []string) {
err := data.RecalculateStatistics(models.AROUNDTHEWORLD, legID, since, dryRun)
if err != nil {
panic(err)
}
},
}

func init() {
recalculateStatisticsCmd.AddCommand(aroundtheworldCmd)
}
15 changes: 15 additions & 0 deletions cmd/badge.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package cmd

import (
"github.com/spf13/cobra"
)

// badgeCmd represents the badge command
var badgeCmd = &cobra.Command{
Use: "badge",
Short: "Modify Badges",
}

func init() {
rootCmd.AddCommand(badgeCmd)
}
22 changes: 22 additions & 0 deletions cmd/badge_global.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package cmd

import (
"github.com/kcapp/api/data"
"github.com/spf13/cobra"
)

// recalculateGlobalBadgeCmd represents the global command
var recalculateGlobalBadgeCmd = &cobra.Command{
Use: "global",
Short: "Recalculate Global Badges",
Run: func(cmd *cobra.Command, args []string) {
err := data.RecalculateGlobalBadges()
if err != nil {
panic(err)
}
},
}

func init() {
recalculateBadgeCmd.AddCommand(recalculateGlobalBadgeCmd)
}
22 changes: 22 additions & 0 deletions cmd/badge_leg.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package cmd

import (
"github.com/kcapp/api/data"
"github.com/spf13/cobra"
)

// recalculateLegBadgesCmd represents the leg command
var recalculateLegBadgesCmd = &cobra.Command{
Use: "leg",
Short: "Recalculate Leg Badges",
Run: func(cmd *cobra.Command, args []string) {
err := data.RecalculateLegBadges()
if err != nil {
panic(err)
}
},
}

func init() {
recalculateBadgeCmd.AddCommand(recalculateLegBadgesCmd)
}
22 changes: 22 additions & 0 deletions cmd/badge_match.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package cmd

import (
"github.com/kcapp/api/data"
"github.com/spf13/cobra"
)

// recalculateMatchBadgeCmd represents the match command
var recalculateMatchBadgeCmd = &cobra.Command{
Use: "match",
Short: "Recalculate Match Badges",
Run: func(cmd *cobra.Command, args []string) {
err := data.RecalculateMatchBadges()
if err != nil {
panic(err)
}
},
}

func init() {
recalculateBadgeCmd.AddCommand(recalculateMatchBadgeCmd)
}
23 changes: 23 additions & 0 deletions cmd/bermudatriangle.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package cmd

import (
"github.com/kcapp/api/data"
"github.com/kcapp/api/models"
"github.com/spf13/cobra"
)

// bermudatriangleCmd represents the bermudatriangle command
var bermudatriangleCmd = &cobra.Command{
Use: "bermudatriangle",
Short: "Recalculate Bermuda Triangle statistics",
Run: func(cmd *cobra.Command, args []string) {
err := data.RecalculateStatistics(models.BERMUDATRIANGLE, legID, since, dryRun)
if err != nil {
panic(err)
}
},
}

func init() {
recalculateStatisticsCmd.AddCommand(bermudatriangleCmd)
}
23 changes: 23 additions & 0 deletions cmd/cricket.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package cmd

import (
"github.com/kcapp/api/data"
"github.com/kcapp/api/models"
"github.com/spf13/cobra"
)

// cricketCmd represents the cricket command
var cricketCmd = &cobra.Command{
Use: "cricket",
Short: "Recalculate Cricket statistics",
Run: func(cmd *cobra.Command, args []string) {
err := data.RecalculateStatistics(models.CRICKET, legID, since, dryRun)
if err != nil {
panic(err)
}
},
}

func init() {
recalculateStatisticsCmd.AddCommand(cricketCmd)
}
23 changes: 23 additions & 0 deletions cmd/dartsatx.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package cmd

import (
"github.com/kcapp/api/data"
"github.com/kcapp/api/models"
"github.com/spf13/cobra"
)

// dartsatxCmd represents the dartsatx command
var dartsatxCmd = &cobra.Command{
Use: "dartsatx",
Short: "Recalculate Darts at X statistics",
Run: func(cmd *cobra.Command, args []string) {
err := data.RecalculateStatistics(models.DARTSATX, legID, since, dryRun)
if err != nil {
panic(err)
}
},
}

func init() {
recalculateStatisticsCmd.AddCommand(dartsatxCmd)
}
15 changes: 15 additions & 0 deletions cmd/elo.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package cmd

import (
"github.com/spf13/cobra"
)

// eloCmd represents the elo command
var eloCmd = &cobra.Command{
Use: "elo",
Short: "Modify Elo",
}

func init() {
rootCmd.AddCommand(eloCmd)
}
23 changes: 23 additions & 0 deletions cmd/fourtwenty.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package cmd

import (
"github.com/kcapp/api/data"
"github.com/kcapp/api/models"
"github.com/spf13/cobra"
)

// fourtwentyCmd represents the fourtwenty command
var fourtwentyCmd = &cobra.Command{
Use: "420",
Short: "Recalculate 420 statistics",
Run: func(cmd *cobra.Command, args []string) {
err := data.RecalculateStatistics(models.FOURTWENTY, legID, since, dryRun)
if err != nil {
panic(err)
}
},
}

func init() {
recalculateStatisticsCmd.AddCommand(fourtwentyCmd)
}
23 changes: 23 additions & 0 deletions cmd/gotcha.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package cmd

import (
"github.com/kcapp/api/data"
"github.com/kcapp/api/models"
"github.com/spf13/cobra"
)

// gotchaCmd represents the gotcha command
var gotchaCmd = &cobra.Command{
Use: "gotcha",
Short: "Recalculate Gotcha statistics",
Run: func(cmd *cobra.Command, args []string) {
err := data.RecalculateStatistics(models.GOTCHA, legID, since, dryRun)
if err != nil {
panic(err)
}
},
}

func init() {
recalculateStatisticsCmd.AddCommand(gotchaCmd)
}
Loading
Loading