[codeface] [PATCH 22/27] Temporary simplified method to obtain mailing list ids

  • From: <wolfgang.mauerer@xxxxxxxxxxxxxxxxx>
  • To: <codeface@xxxxxxxxxxxxx>
  • Date: Sun, 27 Sep 2015 02:28:18 +0200

From: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxx>

An inconsistency in the database scheme requires
to introduce a temporary method that selects the
first best mailing list available for a project.

Signed-off-by: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxxxxxxxx>
---
codeface/R/query.r | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/codeface/R/query.r b/codeface/R/query.r
index 8cbc22e..382a391 100644
--- a/codeface/R/query.r
+++ b/codeface/R/query.r
@@ -342,6 +342,23 @@ query.person.name <- function(con, person.id) {
return(NA)
}

+## Obtain the id of the first mailing list associated with a
+## project. This is required since currently, the type of a mailing
+## list (devel/user) is no stored in the database. Consequently,
+## we cannot distinguish the type without access to the configuration
+## file, as is the case for the web frontend.
+## The function should go away once this inconsistency is resolved.
+query.ml.id.simple.con <- function(con, pid) {
+ query <- str_c("SELECT id, name FROM mailing_list WHERE projectId=",
+ pid)
+ res <- dbGetQuery(con, query)
+
+ if (!is.null(res)) {
+ return(res[[1]])
+ }
+ return(NULL)
+}
+
## Obtain a mailing list id. The explicit name of the mailing
## list is required
query.ml.id.con <- function(con, pid, ml) {
@@ -352,7 +369,7 @@ query.ml.id.con <- function(con, pid, ml) {
return(res)
}

-## Obtain the mailing list using a conf object. It suffices
+## Obtain the mailing list using a full conf object. It suffices
## to specify the _type_ of the mailing list (i.e., "dev" or "user")
query.ml.id <- function(conf, ml.type) {
if (!(ml.type %in% c("dev", "user"))) {
--
2.1.4


Other related posts:

  • » [codeface] [PATCH 22/27] Temporary simplified method to obtain mailing list ids - wolfgang.mauerer