Skip to content

Commit 79a328e

Browse files
committed
Only one result per participant in B07Ca_multi
1 parent 600f212 commit 79a328e

File tree

1 file changed

+5
-3
lines changed
  • inst/shiny/B07Ca_multi

1 file changed

+5
-3
lines changed

inst/shiny/B07Ca_multi/app.R

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ library(flipdownr)
1616
title <- "Challenge analyses multivariées"
1717
# Note: define real deadline in environment variables in RStudio Connect
1818
deadline <- Sys.getenv("CHALLENGE_DEADLINE",
19-
unset = "2024-02-23 00:00:00")
19+
unset = "2025-02-21 00:00:00")
2020

2121
# Read data from the SQLite database
2222
dir <- "/data1/B07_challenge"
2323
if (!file.exists(dir))
24-
dir <- "~/Desktop/B07_challenge" # Alternate dir for local tests
24+
dir <- "~/B07_challenge" # Alternate dir for local tests
2525
database <- file.path(dir, "multi.sqlite")
2626
table <- "multi"
2727

@@ -44,7 +44,7 @@ score_multi <- function(x) {
4444
#if (any(x < 0) | any(x > 1))
4545
# return(structure(NA,
4646
# message = paste("Le r\u00e9sultat doit contenir des valeurs entre 0 et 1 uniquement. Corrigez et resoumettez !")))
47-
score <- as.numeric(sum(x)) # Score is the sum of all the 20 individual scores for the different charts
47+
score <- as.numeric(sum(x)) # Score is the sum of all the 10 individual scores for the different charts
4848
structure(score,
4949
message = paste0("Votre proposition est accept\u00e9e. Son score est de ",
5050
round(score, 1), "."))
@@ -184,6 +184,8 @@ server <- function(input, output) {
184184
ranking <- ranking[order(-ranking$score, as.numeric(ranking$date)), ]
185185
ranking$date <- as.POSIXct(ranking$date, origin = "1960-01-01")
186186
ranking$date <- format(ranking$date, "%Y-%m-%d %H:%M:%S")
187+
# Keep only best score for each student or team
188+
ranking <- ranking[!duplicated(ranking$project), ]
187189
}
188190
message("Date reworked")
189191
# Add a column with medals for the three first results

0 commit comments

Comments
 (0)