[codeface] Re: [PATCH 2/2] Add query to get number of messages produced by each developer

  • From: Mitchell Joblin <joblin.m@xxxxxxxxx>
  • To: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxxxxxxxx>
  • Date: Fri, 27 Nov 2015 14:02:41 +0100

On Thu, Nov 26, 2015 at 6:43 PM, Wolfgang Mauerer
<wolfgang.mauerer@xxxxxxxxxxxxxxxxx> wrote:



Am 26/11/2015 um 17:27 schrieb Mitchell Joblin:
- The aggregation is computed across all mailing lists for
a single project and organized by developer global ids

Signed-off-by: Mitchell Joblin <mitchell.joblin.ext@xxxxxxxxxxx>
---
codeface/R/query.r | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/codeface/R/query.r b/codeface/R/query.r
index 68fe018..5f9e72b 100644
--- a/codeface/R/query.r
+++ b/codeface/R/query.r
@@ -566,6 +566,21 @@ query.mail.edgelist <- function(con, pid, start.date,
end.date) {
return(dat)
}

+## Compute the number messages each author generated across all mailing
lists
+## for a single project
+query.author.mail.count <- function(con, pid, start.date, end.date) {
+ query <- str_c("SELECT author, COUNT(*) as freq",
+ "FROM mail",
+ "WHERE projectId=", pid,
+ "AND creationDate >=", sq(start.date),
+ "AND creationDate <", sq(end.date),
+ "GROUP BY author", sep=" ")

looks good to me. For the sake of consistency: We don't use sep=" "
in any other query, but integrate the necessary spaces directly into
the string constants.

I used it in other places e.g., query.mail.edgelist. Embedding the
spaces in the query string gets ugly and error prone, its easy to
forget a space because it also depends on the statement type. Isn't it
better to have the whitespace located in a single place instead of
spread all over the place in each string component of the query?

Cheers,

Mitchell


Reviewed-by: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxxxxxxxx>

Thanks, Wolfgang


+
+ dat <- dbGetQuery(con, query)
+
+ return(dat)
+}
+
## Distributions for commit statistics
query.contributions.stats.range <- function(con, range.id,
include.id=FALSE) {
if (include.id) {


Other related posts: