Use workaround for MATOMO bug with users by country

Resolves
https://gitlab.ids-mannheim.de/tfnd/IDS-Nutzungsdatenreport/-/issues/14

Change-Id: I72015a50d145fd503b69523ba0f770ddd66e421f
diff --git a/R/matomoquery.R b/R/matomoquery.R
index cfdfb86..2bdb74e 100644
--- a/R/matomoquery.R
+++ b/R/matomoquery.R
@@ -15,6 +15,7 @@
 #' matomo interface under Settings -> Personal -> Settings -> API Authentication Token
 #' and pass it here, or you can make it persistent with \code{\link{persistAccessToken}}.
 #' @param getMethod    API method to call – default: VisitsSummary.get
+#' @param ignoreEmptyResult if FALSE stop with error message on empty list results, otherwise return empty list
 #' @return Data frame with visits summary as returned by matomo. Note that the \code{date} column in the returned data frame refers to the first day of the respective period.
 #'
 #' @importFrom httr2 request req_url_query req_perform resp_body_json resp_body_raw req_error
@@ -39,7 +40,8 @@
                              removeFirst = FALSE,
                              removeLast = FALSE,
                              accessToken = getAccessToken(matomoUrl),
-                             getMethod = "VisitsSummary.get"
+                             getMethod = "VisitsSummary.get",
+                             ignoreEmptyResult = FALSE
 ) {
   if ((is.null(accessToken) || accessToken == '' ) && matomoUrl != "https://demo.matomo.org/") {
     stop(
@@ -73,7 +75,7 @@
   }
 
   if (period=="range") {
-    df <- if (is.list(l) && length(l) == 0) {
+    df <- if (!ignoreEmptyResult && is.list(l) && length(l) == 0) {
       stop(paste0("API call ",  res$url, " returned the empty list [].\n"), call. = FALSE)
     } else if (is.list(l)) {
       df <- bind_rows(l)