Skip to content

Commit

Permalink
Merge branch 'release/2.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
thordy committed Sep 12, 2023
2 parents bbb3eb6 + 92c58fc commit 89fc1d7
Show file tree
Hide file tree
Showing 75 changed files with 4,683 additions and 672 deletions.
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
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## [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
Expand Down Expand Up @@ -125,6 +140,7 @@
#### Feature
- Intial version of API for [kcapp-frontend](https://github.com/kcapp/frontend)

[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
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)
}
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: "fourtwenty",
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

0 comments on commit 89fc1d7

Please sign in to comment.