added extra logging to trace blocked swipe data events.

#39
This commit is contained in:
Chris.Watts90@outlook.com 2017-02-23 16:56:10 +00:00
parent 71bb5b70af
commit 9fa97e2fc9
2 changed files with 4 additions and 1 deletions

View File

@ -351,14 +351,16 @@ namespace SQLiteRepository
var logDirection = GetLogDirection(ident.UserId_FK);
#region Check the user hasnt registered an event in the last few minutes..
//BUG: what happens if unassociated cards are swiped within the threshold? need to get all of them.
var hysteresisThresholdMinutes = Convert.ToInt32(ConfigurationManager.AppSettings["SwipeTimeGap"] ?? "3");
var threshold = DateTime.UtcNow.AddMinutes(0 - hysteresisThresholdMinutes);
var logs = _connection.Query<TimeLogDb>(
SQLiteProcedures.GET_LOGS_IN_LAST_X_MINUTES,
threshold.Ticks, ident.UserId_FK);
_logger.Trace("Checking last swipe event gap");
if (logs.Any())
{
_logger.Error("Not logging event for user id: {0}, logged event within TimeGap Threshold of {1}", ident.UserId_FK, threshold);
logId = -1;
return OperationResponse.FAILED;
}

View File

@ -45,6 +45,7 @@
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SQLite, Version=1.0.104.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\packages\System.Data.SQLite.Core.1.0.104.0\lib\net451\System.Data.SQLite.dll</HintPath>