mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
update activity log
This commit is contained in:
parent
827602711e
commit
24dc91160d
@ -84,19 +84,16 @@ namespace Emby.Server.Implementations.Activity
|
|||||||
using (var connection = CreateConnection(true))
|
using (var connection = CreateConnection(true))
|
||||||
{
|
{
|
||||||
var commandText = BaseActivitySelectText;
|
var commandText = BaseActivitySelectText;
|
||||||
|
|
||||||
var whereClauses = new List<string>();
|
var whereClauses = new List<string>();
|
||||||
var paramList = new List<object>();
|
|
||||||
|
|
||||||
if (minDate.HasValue)
|
if (minDate.HasValue)
|
||||||
{
|
{
|
||||||
whereClauses.Add("DateCreated>=?");
|
whereClauses.Add("DateCreated>=@DateCreated");
|
||||||
paramList.Add(minDate.Value.ToDateTimeParamValue());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var whereTextWithoutPaging = whereClauses.Count == 0 ?
|
var whereTextWithoutPaging = whereClauses.Count == 0 ?
|
||||||
string.Empty :
|
string.Empty :
|
||||||
" where " + string.Join(" AND ", whereClauses.ToArray());
|
" where " + string.Join(" AND ", whereClauses.ToArray());
|
||||||
|
|
||||||
if (startIndex.HasValue && startIndex.Value > 0)
|
if (startIndex.HasValue && startIndex.Value > 0)
|
||||||
{
|
{
|
||||||
@ -122,13 +119,31 @@ namespace Emby.Server.Implementations.Activity
|
|||||||
commandText += " LIMIT " + limit.Value.ToString(_usCulture);
|
commandText += " LIMIT " + limit.Value.ToString(_usCulture);
|
||||||
}
|
}
|
||||||
|
|
||||||
var totalRecordCount = connection.Query("select count (Id) from ActivityLogEntries" + whereTextWithoutPaging, paramList.ToArray()).SelectScalarInt().First();
|
|
||||||
|
|
||||||
var list = new List<ActivityLogEntry>();
|
var list = new List<ActivityLogEntry>();
|
||||||
|
|
||||||
foreach (var row in connection.Query(commandText, paramList.ToArray()))
|
using (var statement = connection.PrepareStatement(commandText))
|
||||||
{
|
{
|
||||||
list.Add(GetEntry(row));
|
if (minDate.HasValue)
|
||||||
|
{
|
||||||
|
statement.TryBind("@DateCreated", minDate.Value.ToDateTimeParamValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var row in statement.ExecuteQuery())
|
||||||
|
{
|
||||||
|
list.Add(GetEntry(row));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int totalRecordCount;
|
||||||
|
|
||||||
|
using (var statement = connection.PrepareStatement("select count (Id) from ActivityLogEntries" + whereTextWithoutPaging))
|
||||||
|
{
|
||||||
|
if (minDate.HasValue)
|
||||||
|
{
|
||||||
|
statement.TryBind("@DateCreated", minDate.Value.ToDateTimeParamValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
totalRecordCount = statement.ExecuteQuery().SelectScalarInt().First();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new QueryResult<ActivityLogEntry>()
|
return new QueryResult<ActivityLogEntry>()
|
||||||
|
@ -3860,7 +3860,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
whereClauses.Add("LocationType=@LocationType");
|
whereClauses.Add("LocationType=@LocationType");
|
||||||
if (statement != null)
|
if (statement != null)
|
||||||
{
|
{
|
||||||
statement.TryBind("LocationType", query.LocationTypes[0].ToString());
|
statement.TryBind("@LocationType", query.LocationTypes[0].ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3881,7 +3881,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
whereClauses.Add("LocationType<>@ExcludeLocationTypes");
|
whereClauses.Add("LocationType<>@ExcludeLocationTypes");
|
||||||
if (statement != null)
|
if (statement != null)
|
||||||
{
|
{
|
||||||
statement.TryBind("ExcludeLocationTypes", query.ExcludeLocationTypes[0].ToString());
|
statement.TryBind("@ExcludeLocationTypes", query.ExcludeLocationTypes[0].ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user