Skip to content

Commit

Permalink
adjust point_id and scores around ends of sets to be consistent with …
Browse files Browse the repository at this point in the history
…pre-1.7 versions v1.7.1
  • Loading branch information
raymondben committed Mar 15, 2024
1 parent a9919f9 commit 6505b39
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: datavolley
Title: Reading and Analyzing DataVolley Scout Files
Version: 1.7.0
Version: 1.7.1
Authors@R: c(person("Ben", "Raymond", email = "[email protected]", role = c("aut", "cre")),
person("Adrien", "Ickowicz", role = "aut"),
person("Tyler", "Widdison", role = "aut"),
Expand Down
11 changes: 5 additions & 6 deletions R/read_dv.R
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ read_dv <- function(filename, insert_technical_timeouts=TRUE, do_warn=FALSE, do_
temp_end_of_set <- grepl("^\\*\\*[[:digit:]]set", out$plays$code, ignore.case = TRUE)
sideout_scoring <- grepl("sideout", out$meta$match$regulation)
for (k in seq_len(nrow(out$plays))[-1]) {
if (temp_point[k-1] || temp_timeout[k] || temp_timeout[k-1] || temp_end_of_set[k-1]) { ## timeout[k-1] otherwise the following play does not start with a new point_id. Also temp_end_of_set[k-1] so that new sets start with reset scores
if (temp_point[k-1] || temp_timeout[k] || temp_timeout[k-1]) { ## timeout[k-1] otherwise the following play does not start with a new point_id
pid <- pid + 1
} else if (sideout_scoring && temp_setterpos[k]) {
## in sideout scoring, we won't see points assigned unless the team is serving, but we still see the *z or az code
Expand Down Expand Up @@ -520,14 +520,13 @@ read_dv <- function(filename, insert_technical_timeouts=TRUE, do_warn=FALSE, do_

temp_home_team_score <- scores$home_team_score
temp_visiting_team_score <- scores$visiting_team_score
temp_home_team_score[1] <- temp_visiting_team_score[1] <- 0L ## start with zeros
## will still have NA scores for timeouts and technical timeouts, patch NAs where we can
temp_pt <- out$plays$point
for (k in seq_len(nrow(out$plays))[-1]) {
if (grepl(">LUp", out$plays$code[k], ignore.case = TRUE)) {
## the lineup codes at the start of a set should have zero team scores
temp_home_team_score[k] <- 0L
temp_visiting_team_score[k] <- 0L
if (grepl("^\\*\\*[[:digit:]]set", out$plays$code[k], ignore.case = TRUE)) {
## make end-of-set row have the same as the preceding scores
if (is.na(temp_home_team_score[k])) temp_home_team_score[k] <- temp_home_team_score[k-1]
if (is.na(temp_visiting_team_score[k])) temp_visiting_team_score[k] <- temp_visiting_team_score[k-1]
} else {
if (is.na(temp_home_team_score[k]) & !temp_pt[k]) {
temp_home_team_score[k] <- temp_home_team_score[k-1]
Expand Down

0 comments on commit 6505b39

Please sign in to comment.