From 48ebfaa12fe6392ecee70a24209fc524531c9a87 Mon Sep 17 00:00:00 2001
From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch>
Date: Thu, 21 Dec 2017 11:09:44 +0100
Subject: [PATCH] Make expiry threshold a parameter of GraceLocationSummary().

Refers to #1
---
 AutoTx/AutoTx.cs | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/AutoTx/AutoTx.cs b/AutoTx/AutoTx.cs
index dcebe53..350c4ac 100644
--- a/AutoTx/AutoTx.cs
+++ b/AutoTx/AutoTx.cs
@@ -215,7 +215,7 @@ namespace AutoTx
 
             msg += "\n------ Grace location status ------\n";
             try {
-                msg += GraceLocationSummary();
+                msg += GraceLocationSummary(_config.GracePeriod);
             }
             catch (Exception ex) {
                 writeLog("CheckGraceLocation() failed: " + ex.Message, true);
@@ -921,7 +921,7 @@ namespace AutoTx
         }
 
         public void CheckGraceLocation() {
-            writeLogDebug(GraceLocationSummary());
+            writeLogDebug(GraceLocationSummary(_config.GracePeriod));
         }
 
         /// <summary>
@@ -931,8 +931,9 @@ namespace AutoTx
         /// name-timestamp exceeds the configured grace period and generate a summary
         /// containing the age and size of those directories.
         /// </summary>
-        public string GraceLocationSummary() {
-            var expired = ExpiredDirs(_config.GracePeriod);
+        /// <param name="threshold">The number of days used as expiration threshold.</param>
+        public string GraceLocationSummary(int threshold) {
+            var expired = ExpiredDirs(threshold);
             var report = "";
             foreach (var userdir in expired.Keys) {
                 report += "\n - user '" + userdir + "'\n";
-- 
GitLab