[codeface] [PATCH 11/26] Fix number of messages in mailing list download

  • From: Claus Hunsen <hunsen@xxxxxxxxxxxxxxxxx>
  • To: codeface@xxxxxxxxxxxxx
  • Date: Thu, 13 Oct 2016 17:29:43 +0200

From: Thomas Bock <bockthom@xxxxxxxxxxxxxxxxx>

The number of messages to download from a certain date up to now was not 
computed correctly. This fix determines the last date before at which a message 
was sent and subtracts the cumuluative sum of emails of the date from the most 
recent cumulative sum of emails.

Signed-off-by: Thomas Bock <bockthom@xxxxxxxxxxxxxxxxx>
---
 codeface/R/ml/download.r | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/codeface/R/ml/download.r b/codeface/R/ml/download.r
index ddebecd..723e2a2 100755
--- a/codeface/R/ml/download.r
+++ b/codeface/R/ml/download.r
@@ -52,7 +52,11 @@ get.postings <- function(ml) {
 
 ## Select the number of messages from a given date until today
 num.messages.fromdate <- function(msglist, from.date) {
-  msglist <- msglist[msglist$date >= from.date,]
+
+  # Determine the last date before from.date at which a message was sent
+  date.before.from.date <- max(msglist[msglist$date < from.date,]$date)
+
+  msglist <- msglist[msglist$date >= date.before.from.date,]
   return(max(msglist$cumulative) - min(msglist$cumulative))
 }
 
-- 
2.10.0


Other related posts: