Skip to content

Commit

Permalink
update readme (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alejandro Alvarez authored Feb 4, 2024
1 parent 9abedf7 commit dbc990d
Show file tree
Hide file tree
Showing 5 changed files with 170 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# vtrain
Utilidad para generar planes de entrenamiento de media maratón y maratón siguiendo los métodos de [Jack Daniels](https://en.wikipedia.org/wiki/Jack_Daniels_(coach)) ([VDOT](https://planesmaraton.com/2018/10/20/entrenamiento-de-jack-daniels-el-parametro-vdot/)). Con su metodología he conseguido bajar de 2h46 en maratón (Atenas) en 2019 a 2h36 en Valencia 2022 y 2h28 en Valencia 2023.

Utilidad para generar planes de entrenamiento de 10k, media maratón y maratón siguiente los métodos de [Jack Daniels](https://en.wikipedia.org/wiki/Jack_Daniels_(coach)) ([VDOT](https://planesmaraton.com/2018/10/20/entrenamiento-de-jack-daniels-el-parametro-vdot/)). Con su metodología he conseguido bajar de 2h46 en maratón (Atenas) en 2019 a 2h36 en Valencia 2022 y 2h28 en Valencia 2023.

Puedes consultar más información en [su libro](https://www.amazon.com/Daniels-Running-Formula-Jack-Tupper/dp/1450431836).

Expand Down
6 changes: 3 additions & 3 deletions cmd/plan/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ Crea un nuevo plan de entrenamiento`,
// check if raceDate format is YYYY-MM-DD and if distance is 21k or 42k
if cm.IsValidDate(raceDate) {
if cm.IsValidTime(raceTime) {
if distance != "21" && distance != "42" {
fmt.Println(color.Colorize(color.Red, "Distancia inválida. Debe ser 21 o 42"))
if distance != "21" && distance != "42" && distance != "10" && distance != "0"{
fmt.Println(color.Colorize(color.Red, "Distancia inválida. Debe ser 10, 21, 42 o 0 para entrenamiento general"))
return
}
err := pl.CreatePlan(VdotConfig, distance, raceDate, raceTime)
Expand All @@ -61,7 +61,7 @@ Crea un nuevo plan de entrenamiento`,

func init() {
// distance and raceDate are required flags
PlanCmd.Flags().StringVarP(&distance, "distancia", "d", "", "Distancia objetivo (21 o 42)")
PlanCmd.Flags().StringVarP(&distance, "distancia", "d", "", "Distancia objetivo (10, 21, 42 o 0 para entrenamiento general)")
PlanCmd.MarkFlagRequired("distancia")
PlanCmd.Flags().StringVarP(&raceDate, "fechaCarrera", "f", "", "Fecha de la carrera (YYYY-MM-DD)")
PlanCmd.MarkFlagRequired("fechaCarrera")
Expand Down
71 changes: 71 additions & 0 deletions pkg/common/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,84 +4,155 @@ planConfig:
c2-42: 3S + 6U + 4 MIN S + 5U + 3 MIN S + 3U + 2 MIN S + 2U + 3S (24k)
c1-21: 4S + 5M + 1U + 5M + 1U + 2S (18k)
c2-21: 3S + 3U + 2 MIN S + 3U + 3 MIN S + 3U + 2 MIN S + 2U + 3S (18k)
c1-10: 3S + 4 x 1.2I C/3 MIN TR + 3S (11k)
c2-10: 3S + 4 X 2U C/1 MIN + 3S (13k)
pre1: 3S + 10 X 1' I C/1 MIN S + 3S
pre2: 5S + 3U + 5S
km-pre:
km-42: 160k
km-21: 81k
km-10: 70k
s2:
c1-42: 3S + 6U + 16S + 2 X 3U C/DESC 2 MIN + 3S (34k)
c2-42: 3S + 6 X 1I + 4 X 400 R C/3 MIN S + 3S (14k)
c1-21: 3S + 3U + 6S + 2 X 2U C/DESC 2 MIN + 3S (19k)
c2-21: 3S + 3 X 1I + 4 X 400 R C/3 MIN S + 3S (11k)
c1-10: 3S + 5 x 1I C/400 TR + 3S (13k)
c2-10: 2S + 5U + 4 X 200R C/200 TR + 3S (12k)
pre1: 12S
pre2: 5S + 4U + 5S
km-pre:
km-42: 148k
km-21: 75k
km-10: 70k
s3:
c1-42: 32S (32k)
c2-42: 20KM PROG -> U 5 KMS + 3S (23k)
c1-21: 18S (18k)
c2-21: 10KM PROG -> U 5 KMS + 3S (13k)
c1-10: 3S + 6 x 800I C/400 TR + 3S (13k)
c2-10: 2S + 5 X 2U C/1 MIN + 6 A/D + 2S (15k)
pre1: 3S + 10 X 1' I C/1 MIN S + 3S
pre2: 5S + 5U + 5S
km-pre:
km-42: 155k
km-21: 76k
km-10: 73k
s4:
c1-42: 10S + 10M + 2U + 10M + 2U + 3S (37k)
c2-42: 3S + 8U + 5 MIN S + 6U + 4 MIN S + 5U + 3 MIN S + 2U + 3S (33k)
c1-21: 3S + 5M + 2U + 5M + 2U + 2S (19k)
c2-21: 3S + 4U + 5 MIN S + 3U + 4 MIN S + 3U + 3 MIN S + 2U + 2S (19k)
c1-10: 3S + 4 x 1.2I C/3 MIN TR + 3S (12k)
c2-10: 2S + 8M C/2 MIN + 3U C/1 MIN + 2U + 4 X 200 R C/200 TR + 2S (18k)
pre1: 14S
pre2: 5S + 6U + 5S
km-pre:
km-42: 170k
km-21: 83k
km-10: 75k
s5:
c1-42: 3S + 6U + 16S + 6U + 3S (34k)
c2-42: 3S + 3 X 2I C/4 MIN S + 3 X 1I C/2 MIN S + 3S (15k)
c1-21: 3S + 3U + 8S + 3U + 2S (19k)
c2-21: 3S + 3 X 2 I C/4 MIN S + 3 X 1I C/2 MIN S + 3S (15k)
c1-10: 4S + 5 x 1I C/400 TR + 3S (16k)
c2-10: 4S + 5U + 3S (12k)
pre1: 15S
pre2: 5S + 7U + 5S
km-pre:
km-42: 149k
km-21: 79k
km-10: 73k
s6:
c1-42: 35S (35k)
c2-42: 13S + 13M + 2U + 6M + 2U + 2M (38k)
c1-21: 18S (18k)
c2-21: 4S + 6M + 2U + 3M + 2U + 2M (19k)
c1-10: 2S + 16M + 6 A/D + 3S (21k)
c2-10: 4S + 5 x 2U C/1 MIN + 6 A/D 3S (18k)
pre1: 3S + 20 X 1'I C/1 MIN S + 3S
pre2: 4S + 8U + 4S
km-pre:
km-42: 173k
km-21: 82k
km-10: 71k
s7:
c1-42: 16KM PROG -> U 6 KMS + 3S (19k)
c2-42: 3S + 8U + 5MIN S + 6U + 4 MIN S + 5U + 3 MIN S + 3U + 2 MIN S + 2U + 3S (33k)
c1-21: 8KM PROG -> U 5 KMS + 3S (11k)
c2-21: 2S + 4U + 5MIN S + 3U + 4 MIN S + 3U + 3 MIN S + 3U + 2 MIN S + 2U + 2S (19k)
c1-10: 4S + 5 X 2U C/1 MIN + 3S (12k)
c2-10: 4S + 6 x 1I C/400 TR + 3S (13k)
pre1: 15S
pre2: 4S + 8U + 4S
km-42: 152k
km-21: 75k
km-10: 70k
s8:
c1-42: 3S + 6U + 16S + 2 X 3U C/DESC 2 MIN + 3S (34k)
c2-42: 3S + 6 X 1I C/2 MIN S + 4 X 400 R C/400 S + 3 MIN S (12k)
c1-21: 3S + 3U + 7S + 2 X 2U C/DESC 2 MIN + 2S (19k)
c2-21: 3S + 5 X 1I C/2 MIN S + 4 X 400 R C/400 S + 3 MIN S (11k)
c1-10: 4S + 5U + 3S (12k)
c2-10: 4S + 5 x 1.2 I 3 MIN TR + 2S (13k)
pre1: 3S + 2 X 4U C/2 MIN S + 3S
pre2: 3S + 9U + 3S
km-pre:
km-42: 146k
km-21: 75k
km-10: 70k
s9:
c1-42: 35S (35k)
c2-42: 3S + 3 X 2U C/1 MIN S + 3 X 1I C/2 MIN S + 3 X 400 R C/400 S + 3S (16k)
c1-21: 18S (18k)
c2-21: 3S + 3 X 2U C/1 MIN S + 3 X 1I C/2 MIN S + 3 X 400 R C/400 S + 3S (16k)
c1-10: 3S + 5 X 2U C/1 MIN + 3S (11k)
c2-10: 4S + 6 x 1I C/400 TR + 2S (12k)
pre1: 16S
pre2: 3S + 9U + 3S
km-pre:
km-42: 151k
km-21: 79k
km-10: 68k
s10:
c1-42: 10S + 10M + 2U + 10M + 2U + 3S (37k)
c2-42: 3S + 4 X 3U C/2 MIN S + 3S (18k)
c1-21: 3S + 5M + 2U + 5M + 2U + 2S (19k)
c2-21: 3S + 4 X 3U C/2 MIN S + 2S (17k)
c1-10: 3S + 5U + 3S (11k)
c2-10: 3S + 5 x 1.2 I 3 MIN TR + 2S (12k)
pre1: 3S + 4 X 2U C/2 MIN S + 3S
pre2: 3S + 10U + 3S
km-pre:
km-42: 155k
km-21: 81k
km-10: 68k
s11:
c1-42: 3S + 3 X 3U C/2 MIN S + 16E (31k)
c2-42: 3S + 3 X 3U C/2 MIN S + 3S (17k)
c1-21: 3S + 3 X 3U C/2 MIN S + 3S (16k)
c2-21: 3S + 3 X 3U C/2 MIN S + 3S (16k)
c1-10: 3S + 2 x 3U C/2 MIN S + 2S (11k)
c2-10: 2S + 6 x 1I C/400 TR + 2S (13k)
pre1: 17S
pre2: 3S + 10U + 3S
km-pre:
km-42: 148k
km-21: 77k
km-10: 68k
s12:
c1-42: 3S + 4 X 1.2 U C/2 MIN S + 3S (15k)
c2-42: 7S (7k)
c1-21: 3S + 3 X 1.2 U C/2 MIN S + 3S (13k)
c2-21: 5S (5k)
c1-10: 2S + 3 x 2U C/2 MIN S + 2S (10k)
c2-10: 25 MIN S + 5 A/D (6k)
pre1: 3S + 10 X 1U C/2 MIN S + 3S
pre2: 3S + 10U + 3S
km-42: 52k
km-21: 32k
km-10: 40K



88 changes: 88 additions & 0 deletions pkg/plan/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ func getVDOT(targetTime string, raceDistance int) (int, error) {
vdotMap = halfMarathonVDOT
case 42:
vdotMap = marathonVDOT
case 10:
vdotMap = halfMarathonVDOT
case 0:
vdotMap = halfMarathonVDOT
default:
return 0, fmt.Errorf("Distancia no soportada: %d", raceDistance)
}
Expand Down Expand Up @@ -286,6 +290,88 @@ func CreatePlan(vtrainConfig structs.VtrainConfig, distance string, raceDate str
}
fmt.Printf("\tKms: %s\n", km21)
}
if distanceInt == 0 {
// Generate the training sessions for the current week
c1 := vtrainConfig.PlanConfig[fmt.Sprintf("s%d", week)].PRE1
c2 := vtrainConfig.PlanConfig[fmt.Sprintf("s%d", week)].PRE2
km21 := vtrainConfig.PlanConfig[fmt.Sprintf("s%d", week)].KMPRE

// Calculate the scheduled dates for c1 and c2
c1Date := startDate.AddDate(0, 0, (week-1)*7+3) // Miercoles
c2Date := startDate.AddDate(0, 0, (week-1)*7+6) // Sabado

// Print or save the training sessions and scheduled dates
fmt.Println(color.Colorize(color.Yellow, "\nSemana "+strconv.Itoa(week)))
if week != 12 {
fmt.Printf("\tLunes\t\t(%s): 10S\n", startDate.AddDate(0, 0, (week-1)*7+1).Format("2006-01-02"))
} else {
fmt.Printf("\tLunes\t\t(%s): 7S\n", startDate.AddDate(0, 0, (week-1)*7+1).Format("2006-01-02"))
}
if week != 12 {
fmt.Printf("\tMartes\t\t(%s): 10S\n", startDate.AddDate(0, 0, (week-1)*7+2).Format("2006-01-02"))
} else {
fmt.Printf("\tMartes\t\t(%s): 7S\n", startDate.AddDate(0, 0, (week-1)*7+2).Format("2006-01-02"))
}
fmt.Println(color.Colorize(color.Red, "\tMiércoles\t("+c1Date.Format("2006-01-02")+"): "+c1))
if week != 12 {
fmt.Println(color.Colorize(color.Blue, "\tJueves\t\t("+startDate.AddDate(0, 0, (week-1)*7+4).Format("2006-01-02")+"): "+"Descanso"))
} else {
fmt.Println(color.Colorize(color.Blue, "\tJueves\t\t("+startDate.AddDate(0, 0, (week-1)*7+4).Format("2006-01-02")+"): "+"Descanso"))
}
if week != 12 {
fmt.Printf("\tViernes\t\t(%s): 10S\n", startDate.AddDate(0, 0, (week-1)*7+5).Format("2006-01-02"))
} else {
fmt.Println(color.Colorize(color.Blue, "\tViernes\t\t("+startDate.AddDate(0, 0, (week-1)*7+5).Format("2006-01-02")+"): "+"Descanso"))
}
fmt.Println(color.Colorize(color.Red, "\tSábado\t\t("+c2Date.Format("2006-01-02")+"): "+c2))
if week != 12 {
fmt.Printf("\tDomingo\t\t(%s): 15S\n", startDate.AddDate(0, 0, (week-1)*7+7).Format("2006-01-02"))
} else {
fmt.Printf("\tDomingo\t\t(%s): Día de la carrera!!\n", startDate.AddDate(0, 0, (week-1)*7+7).Format("2006-01-02"))
}
fmt.Printf("\tKms: %s\n", km21)
}
if distanceInt == 10 {
// Generate the training sessions for the current week
c1 := vtrainConfig.PlanConfig[fmt.Sprintf("s%d", week)].C110
c2 := vtrainConfig.PlanConfig[fmt.Sprintf("s%d", week)].C210
km10 := vtrainConfig.PlanConfig[fmt.Sprintf("s%d", week)].KM10

// Calculate the scheduled dates for c1 and c2
c1Date := startDate.AddDate(0, 0, (week-1)*7+3) // Miercoles
c2Date := startDate.AddDate(0, 0, (week-1)*7+6) // Sabado

// Print or save the training sessions and scheduled dates
fmt.Println(color.Colorize(color.Yellow, "\nSemana "+strconv.Itoa(week)))
if week != 12 {
fmt.Printf("\tLunes\t\t(%s): 10S\n", startDate.AddDate(0, 0, (week-1)*7+1).Format("2006-01-02"))
} else {
fmt.Printf("\tLunes\t\t(%s): 7S\n", startDate.AddDate(0, 0, (week-1)*7+1).Format("2006-01-02"))
}
if week != 12 {
fmt.Printf("\tMartes\t\t(%s): 10S\n", startDate.AddDate(0, 0, (week-1)*7+2).Format("2006-01-02"))
} else {
fmt.Printf("\tMartes\t\t(%s): 7S\n", startDate.AddDate(0, 0, (week-1)*7+2).Format("2006-01-02"))
}
fmt.Println(color.Colorize(color.Red, "\tMiércoles\t("+c1Date.Format("2006-01-02")+"): "+c1))
if week != 12 {
fmt.Println(color.Colorize(color.Blue, "\tJueves\t\t("+startDate.AddDate(0, 0, (week-1)*7+4).Format("2006-01-02")+"): "+"Descanso"))
} else {
fmt.Println(color.Colorize(color.Blue, "\tJueves\t\t("+startDate.AddDate(0, 0, (week-1)*7+4).Format("2006-01-02")+"): "+"Descanso"))
}
if week != 12 {
fmt.Printf("\tViernes\t\t(%s): 10S\n", startDate.AddDate(0, 0, (week-1)*7+5).Format("2006-01-02"))
} else {
fmt.Println(color.Colorize(color.Blue, "\tViernes\t\t("+startDate.AddDate(0, 0, (week-1)*7+5).Format("2006-01-02")+"): "+"Descanso"))
}
fmt.Println(color.Colorize(color.Red, "\tSábado\t\t("+c2Date.Format("2006-01-02")+"): "+c2))
if week != 12 {
fmt.Printf("\tDomingo\t\t(%s): 15S\n", startDate.AddDate(0, 0, (week-1)*7+7).Format("2006-01-02"))
} else {
fmt.Printf("\tDomingo\t\t(%s): Día de la carrera!!\n", startDate.AddDate(0, 0, (week-1)*7+7).Format("2006-01-02"))
}
fmt.Printf("\tKms: %s\n", km10)
}
}
printPaces(distance, raceTime)
return nil
Expand All @@ -310,4 +396,6 @@ func printPaces(distance string, raceTime string) {
fmt.Println(color.Colorize(color.Yellow, "(U) Umbral: "+runningPaces["Umbral"]))
fmt.Println(color.Colorize(color.Yellow, "(I) Intervalo: "+runningPaces["Interval"]))
fmt.Println(color.Colorize(color.Yellow, "(R) Repetición (Ritmo 400m): "+runningPaces["Repeticion"]))
fmt.Println(color.Colorize(color.Yellow, "(A/D) Aceleración/Desaceleración: 30\"/50\""))

}
6 changes: 6 additions & 0 deletions pkg/structs/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ type NestedVtrainConfig struct {
C242 string `yaml:"c2-42"`
C121 string `yaml:"c1-21"`
C221 string `yaml:"c2-21"`
C110 string `yaml:"c1-10"`
C210 string `yaml:"c2-10"`
PRE1 string `yaml:"pre1"`
PRE2 string `yaml:"pre2"`
KMPRE string `yaml:"km-pre"`
KM42 string `yaml:"km-42"`
KM21 string `yaml:"km-21"`
KM10 string `yaml:"km-10"`
}

// It represents a vtrain week
Expand Down

0 comments on commit dbc990d

Please sign in to comment.