experimentTotalRuns returns the total number of runs recorded in the state. Prefers the runs array length when non-empty; falls back to summing all variant counts.
(state *ExperimentState)
| 714 | // experimentTotalRuns returns the total number of runs recorded in the state. |
| 715 | // Prefers the runs array length when non-empty; falls back to summing all variant counts. |
| 716 | func experimentTotalRuns(state *ExperimentState) int { |
| 717 | if len(state.Runs) > 0 { |
| 718 | return len(state.Runs) |
| 719 | } |
| 720 | total := 0 |
| 721 | for _, variants := range state.Counts { |
| 722 | for _, c := range variants { |
| 723 | total += c |
| 724 | } |
| 725 | } |
| 726 | return total |
| 727 | } |
| 728 | |
| 729 | // experimentLastRun returns the date (YYYY-MM-DD) of the most recent run, or "" if unknown. |
| 730 | func experimentLastRun(state *ExperimentState) string { |
no outgoing calls