Skip to content

Commit df8a10c

Browse files
Merge pull request #4 from ThinkR-open/translate_en
Translate EN
2 parents 7f2d8da + 6041106 commit df8a10c

39 files changed

+234
-208
lines changed

NAMESPACE

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
export(connect_db)
44
export(get_info)
5-
export(get_info_chene)
6-
export(get_info_chene_last_truffe)
7-
export(get_info_chene_truffe)
5+
export(get_info_oak)
6+
export(get_info_oak_last_truffle)
7+
export(get_info_oak_truffle)
88
export(get_info_reensemence)
99
export(prepare_leaflet)
1010
export(run_app)
11-
export(update_db_truffe)
11+
export(update_db_truffle)
1212
export(weight_truffles_by)
1313
export(write_db_new_reens)
14-
export(write_db_new_truffe)
14+
export(write_db_new_truffle)
1515
import(shiny)
1616
import(shinyMobile)
1717
importFrom(DBI,ANSI)

NEWS.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
# truffles (development version)
22

3+
- Rename `update_db_truffe()` -> `update_db_truffle()`
4+
- Rename `write_db_new_truffe()` -> `write_db_new_truffle()`
5+
- Rename `get_info_chene()` -> `get_info_oak()`
6+
- Rename `get_info_chene_last_truffe()` -> `get_info_oak_last_truffle()`
7+
- Rename `get_info_chene_truffe()` -> `get_info_oak_truffle()`
8+
39
# truffles 0.0.2
410

511
- Using flexbox in modals
6-
- New function get_info_reensemence() to get information about the latest reseeding date
12+
- New function `get_info_reensemence()` to get information about the latest reseeding date
713
- Add User Doc / Dev Doc in pkgdown
814

915
# truffles 0.0.1
@@ -15,4 +21,4 @@
1521
- New function get_info_chene_truffe() to get information about truffles associated with an oak tree
1622
- New function update_db_truffe() to update a row in the "truffe" table of a database.
1723
- New function weight_truffles_by() to calculate total weight of truffles grouped by specified columns
18-
- New function write_db_new_truffe() to write new truffle data to the database
24+
- New function write_db_new_truffle() to write new truffle data to the database

R/app_server.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ app_server <- function(input, output, session) {
6363

6464

6565
if (isTRUE(global$missingdata)) {
66-
info <- get_info_chene_last_truffe(dbtruffe = global$truffe, theidoak = input$chene_click, filter_missing_info = TRUE)
66+
info <- get_info_oak_last_truffle(dbtruffle = global$truffe, theidoak = input$chene_click, filter_missing_info = TRUE)
6767

6868
golem::invoke_js(
6969
"modal_info_missing",
@@ -78,8 +78,8 @@ app_server <- function(input, output, session) {
7878
)
7979
} else {
8080
info <- get_info(
81-
dbchene = global$chenes,
82-
dbtruffe = global$truffe,
81+
dboak = global$chenes,
82+
dbtruffle = global$truffe,
8383
dbreensemence = global$reensemence,
8484
theidoak = input$chene_click
8585
)
@@ -91,7 +91,7 @@ app_server <- function(input, output, session) {
9191
type = info$chene$type,
9292
date_reens = info$reensemence,
9393
date_p = as.Date(info$chene$planting_date),
94-
der_truf = info$truffes$derniere_truffe,
94+
der_truf = info$truffes$last_truffle,
9595
tot_weight = info$truffes$weight_tot,
9696
last_comment = info$truffes$last_comment,
9797
other_comments = info$truffes$other_comments
@@ -105,7 +105,7 @@ app_server <- function(input, output, session) {
105105
req(input$new_truffe)
106106
log_info_dev("observeEvent(input$new_truffe, ...")
107107

108-
write_db_new_truffe(
108+
write_db_new_truffle(
109109
conn = global$conn,
110110
theidoak = input$new_truffe[1],
111111
date_found = input$new_truffe[2],
@@ -134,7 +134,7 @@ app_server <- function(input, output, session) {
134134
req(input$complete_truffe)
135135
log_info_dev("observeEvent(input$complete_truffe, ...")
136136

137-
update_db_truffe(
137+
update_db_truffle(
138138
conn = global$conn,
139139
idtruffle = input$complete_truffe[2],
140140
idoak = input$complete_truffe[1],

R/get_info.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
#' This function retrieves information about oak trees and truffles based on the provided
55
#' databases and oak tree ID.
66
#'
7-
#' @param dbchene Database containing information about oak trees.
8-
#' @param dbtruffe Database containing information about truffles.
7+
#' @param dboak Database containing information about oak trees.
8+
#' @param dbtruffle Database containing information about truffles.
99
#' @param dbreensemence Database containing reseeding information.
1010
#' @param theidoak ID of the oak tree for which information is to be retrieved.
1111
#'
@@ -19,12 +19,12 @@
1919
#' truffe <- DBI::dbReadTable(conn, name = "truffe")
2020
#' reensemence <- DBI::dbReadTable(conn, name = "reens")
2121
#'
22-
#' get_info(dbchene = chene, dbtruffe = truffe, dbreensemence = reensemence, theidoak = "162")
22+
#' get_info(dboak = chene, dbtruffle = truffe, dbreensemence = reensemence, theidoak = "162")
2323
#' DBI::dbDisconnect(conn)
24-
get_info <- function(dbchene, dbtruffe, dbreensemence, theidoak) {
24+
get_info <- function(dboak, dbtruffle, dbreensemence, theidoak) {
2525
resultat <- list(
26-
chene = get_info_chene(dbchene = dbchene, theidoak = theidoak),
27-
truffes = get_info_chene_truffe(dbtruffe = dbtruffe, theidoak = theidoak),
26+
chene = get_info_oak(dboak = dboak, theidoak = theidoak),
27+
truffes = get_info_oak_truffle(dbtruffle = dbtruffle, theidoak = theidoak),
2828
reensemence = get_info_reensemence(dbreensemence = dbreensemence, theidoak = theidoak)
2929
)
3030

R/get_info_chene.R renamed to R/get_info_oak.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#' This function retrieves information about a specific oak tree based on its ID
55
#' from the provided oak tree database.
66
#'
7-
#' @param dbchene Database containing information about oak trees.
7+
#' @param dboak Database containing information about oak trees.
88
#' @param theidoak ID of the oak tree for which information is to be retrieved.
99
#'
1010
#' @return A list containing information about the oak tree, including its type and
@@ -22,14 +22,14 @@
2222
#' )
2323
#' chene <- DBI::dbReadTable(conn, name = "chenes")
2424
#'
25-
#' get_info_chene(dbchene = chene, theidoak = "162")
25+
#' get_info_oak(dboak = chene, theidoak = "162")
2626
#'
27-
get_info_chene <- function(dbchene, theidoak) {
28-
check_param(dbchene, "data.frame")
27+
get_info_oak <- function(dboak, theidoak) {
28+
check_param(dboak, "data.frame")
2929
check_param(theidoak, "character")
30-
check_names_dataframe(c("idoak", "type", "planting_date"), dbchene)
30+
check_names_dataframe(c("idoak", "type", "planting_date"), dboak)
3131

32-
oak <- dbchene |>
32+
oak <- dboak |>
3333
filter(idoak == theidoak)
3434

3535
return(list(

R/get_info_chene_last_truffe.R renamed to R/get_info_oak_last_truffle.R

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#'
44
#' This function retrieves information about the last truffle found on a specific oak tree.
55
#'
6-
#' @param dbtruffe A data frame containing information about truffles.
6+
#' @param dbtruffle A data frame containing information about truffles.
77
#' @param theidoak The ID of the oak tree.
88
#' @param filter_missing_info logical to filter truffle with missing data
99
#' @importFrom dplyr filter mutate
@@ -12,38 +12,38 @@
1212
#' @export
1313
#' @examples
1414
#'
15-
#' dbtruffe <- data.frame(
15+
#' dbtruffle <- data.frame(
1616
#' idoak = c("123", "123", "456", "789"),
1717
#' estimation = c(1, 0, 1, 0),
1818
#' weight = c(NA, 5, 10, 100),
1919
#' date_found = as.Date(c("2023-01-01", "2023-03-15", "2023-02-01", "2022-12-01"))
2020
#' )
2121
#'
22-
#' get_info_chene_last_truffe(dbtruffe = dbtruffe, theidoak = "123")
23-
#' get_info_chene_last_truffe(dbtruffe = dbtruffe, theidoak = "123", filter_missing_info = TRUE)
24-
get_info_chene_last_truffe <- function(dbtruffe, theidoak, filter_missing_info = FALSE) {
25-
check_param(dbtruffe, "data.frame")
22+
#' get_info_oak_last_truffle(dbtruffle = dbtruffle, theidoak = "123")
23+
#' get_info_oak_last_truffle(dbtruffle = dbtruffle, theidoak = "123", filter_missing_info = TRUE)
24+
get_info_oak_last_truffle <- function(dbtruffle, theidoak, filter_missing_info = FALSE) {
25+
check_param(dbtruffle, "data.frame")
2626
check_param(theidoak, "character")
2727
check_param(filter_missing_info, "logical")
28-
check_names_dataframe(c("weight", "estimation", "idoak"), dbtruffe)
28+
check_names_dataframe(c("weight", "estimation", "idoak"), dbtruffle)
2929

3030

31-
if (!any(theidoak %in% dbtruffe$idoak)) {
31+
if (!any(theidoak %in% dbtruffle$idoak)) {
3232
return(data.frame())
3333
}
3434

3535
if (isTRUE(filter_missing_info)) {
36-
dbtruffe <- dbtruffe |>
36+
dbtruffle <- dbtruffle |>
3737
dplyr::filter(estimation == 1 | is.na(weight))
3838
}
3939

40-
truffe_chene <- dbtruffe |>
40+
truffle_oak <- dbtruffle |>
4141
filter(idoak == theidoak) |>
4242
filter(date_found == max(date_found)) |>
4343
dplyr::mutate(estim_js = dplyr::case_when(
44-
estimation == 1 ~ "checked = 'checked'", # TODO : deplace
44+
estimation == 1 ~ "checked = 'checked'",
4545
TRUE ~ ""
4646
))
4747

48-
return(truffe_chene)
48+
return(truffle_oak)
4949
}

R/get_info_chene_truffe.R renamed to R/get_info_oak_truffle.R

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#' This function retrieves information about truffles associated with a specific oak tree
55
#' based on the oak tree's ID from the provided truffle database.
66
#'
7-
#' @param dbtruffe Database containing information about truffles.
7+
#' @param dbtruffle Database containing information about truffles.
88
#' @param theidoak ID of the oak tree for which information about associated truffles
99
#' is to be retrieved.
1010
#'
@@ -21,29 +21,29 @@
2121
#' )
2222
#' truffe <- DBI::dbReadTable(conn, name = "truffe")
2323
#'
24-
#' get_info_chene_truffe(dbtruffe = truffe, theidoak = "119")
24+
#' get_info_oak_truffle(dbtruffle = truffe, theidoak = "119")
2525
#' DBI::dbDisconnect(conn)
26-
get_info_chene_truffe <- function(dbtruffe, theidoak) {
27-
check_param(dbtruffe, "data.frame")
26+
get_info_oak_truffle <- function(dbtruffle, theidoak) {
27+
check_param(dbtruffle, "data.frame")
2828
check_param(theidoak, "character")
2929
check_names_dataframe(c(
3030
"idoak", "weight", "date_found",
3131
"comment"
32-
), dbtruffe)
33-
truffe_chene <- filter(dbtruffe, idoak == theidoak)
34-
if (nrow(truffe_chene) == 0) {
35-
return(list(weight_tot = 0, derniere_truffe = "-", last_comment = "-", other_comments = "-"))
32+
), dbtruffle)
33+
truffle_oak <- filter(dbtruffle, idoak == theidoak)
34+
if (nrow(truffle_oak) == 0) {
35+
return(list(weight_tot = 0, last_truffle = "-", last_comment = "-", other_comments = "-"))
3636
}
3737

3838

39-
weight_tot <- pull(summarise(truffe_chene, weight_tot = sum(weight,
39+
weight_tot <- pull(summarise(truffle_oak, weight_tot = sum(weight,
4040
na.rm = TRUE
4141
)), weight_tot)
42-
derniere_truffe <- pull(summarise(truffe_chene, date_found = as.Date(max(date_found,
42+
last_truffle <- pull(summarise(truffle_oak, date_found = as.Date(max(date_found,
4343
na.rm = TRUE
4444
))), date_found)
4545

46-
sort_comment <- truffe_chene |>
46+
sort_comment <- truffle_oak |>
4747
arrange(desc(date_found))
4848

4949
last_comment <- paste(as.Date(sort_comment$date_found[1]),
@@ -64,7 +64,7 @@ get_info_chene_truffe <- function(dbtruffe, theidoak) {
6464

6565
return(list(
6666
weight_tot = weight_tot,
67-
derniere_truffe = derniere_truffe,
67+
last_truffle = last_truffle,
6868
last_comment = last_comment,
6969
other_comments = other_comments
7070
))

R/globals.R

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
globalVariables(unique(c(
2-
# app_server:
3-
"planting_date",
4-
"id",
5-
"type",
6-
# get_info_chene:
7-
"id",
8-
# get_info_chene_truffe:
9-
"date_found",
10-
"idoak",
11-
"weight",
12-
"annee",
13-
"present",
14-
# prepare_leaflet:
15-
"estimation",
16-
"info_missing",
17-
"info_reens"
18-
)))
2+
# app_server:
3+
"present",
4+
# get_info_oak:
5+
"idoak",
6+
# get_info_oak_last_truffle:
7+
"date_found", "estimation", "idoak", "weight",
8+
# get_info_oak_truffle:
9+
"date_found", "idoak", "weight",
10+
# get_info_reensemence:
11+
"idoak",
12+
# mod_dataviz_server : <anonymous>:
13+
"annee", "date_found", "type", "weight",
14+
# prepare_leaflet:
15+
"estimation", "idoak", "info_missing", "info_reens", "weight",
16+
# weight_truffles_by:
17+
"weight"
18+
)))

R/mod_carto_leaflet.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ mod_carto_leaflet_server <- function(id, global) {
5353
log_info_dev("prepa leaflet")
5454
# prepa data to js
5555
local$df_prep <- prepare_leaflet(
56-
dbchene = global$chenes,
57-
dbtruffe = global$truffe,
56+
dboak = global$chenes,
57+
dbtruffle = global$truffe,
5858
dbreens = global$reensemence
5959
)
6060
})

R/prepare_leaflet.R

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
#'
44
#' This function prepares data for Leaflet JavaScript visualization.
55
#'
6-
#' @param dbchene A data frame containing information about oak trees.
7-
#' @param dbtruffe A data frame containing information about truffles.
6+
#' @param dboak A data frame containing information about oak trees.
7+
#' @param dbtruffle A data frame containing information about truffles.
88
#' @param dbreens A data frame containing information about reensemencement.
99
#' @importFrom dplyr filter mutate distinct full_join
1010
#' @return A list suitable for passing to Leaflet JavaScript for visualization.
1111
#'
1212
#' @export
1313
#' @examples
14-
#' dbchene <- data.frame(
14+
#' dboak <- data.frame(
1515
#' idoak = c(1, 2, 3),
1616
#' chene_nom = c("Chene 1", "Chene 2", "Chene 3")
1717
#' )
@@ -22,23 +22,23 @@
2222
#' date_reens = c("2022-04-30")
2323
#' )
2424
#'
25-
#' dbtruffe <- data.frame(
25+
#' dbtruffle <- data.frame(
2626
#' idoak = c(1, 1, 3),
2727
#' idtruffle = c(1, 2, 3),
2828
#' estimation = c(1, 0, 1),
2929
#' weight = c(10, 15, NA)
3030
#' )
31-
#' prepare_leaflet(dbchene, dbtruffe, dbreens)
32-
prepare_leaflet <- function(dbchene, dbtruffe, dbreens) {
33-
t <- dbtruffe |>
31+
#' prepare_leaflet(dboak, dbtruffle, dbreens)
32+
prepare_leaflet <- function(dboak, dbtruffle, dbreens) {
33+
t <- dbtruffle |>
3434
dplyr::filter(estimation == 1 | is.na(weight)) |>
3535
dplyr::mutate(info_missing = 1) |>
3636
dplyr::distinct(idoak, info_missing)
3737

3838
r <- dbreens |>
3939
dplyr::mutate(info_reens = 1) |>
4040
dplyr::distinct(idoak, info_reens)
41-
c <- dbchene |>
41+
c <- dboak |>
4242
dplyr::full_join(
4343
t,
4444
by = "idoak"

0 commit comments

Comments
 (0)