mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
add list updated date
This commit is contained in:
parent
222ad854c0
commit
59f11adfc9
3 changed files with 34 additions and 10 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using AutoMapper.QueryableExtensions;
|
||||
|
|
@ -31,6 +32,7 @@ public async Task<ListDetailsDto> GetDetailsAsync(int id)
|
|||
.FirstAsync(x => x.Id == id)
|
||||
.FilterParentListFromMaintainerAdditionalLists();
|
||||
details.RuleCount = await GetActiveRuleCount(details);
|
||||
details.UpdatedDate = await GetUpdatedDate(details);
|
||||
return details;
|
||||
}
|
||||
|
||||
|
|
@ -45,5 +47,16 @@ await DbContext.Snapshots.Where(s => s.FilterListId == details.Id && s.IsComplet
|
|||
.SelectMany(sr => sr.RemovedSnapshotRules)
|
||||
.CountAsync();
|
||||
}
|
||||
|
||||
private async Task<DateTime> GetUpdatedDate(ListDetailsDto details)
|
||||
{
|
||||
return await DbContext.Snapshots.Where(s => s.FilterListId == details.Id && s.IsCompleted)
|
||||
.Include(s => s.AddedSnapshotRules)
|
||||
.Include(s => s.RemovedSnapshotRules)
|
||||
.Where(s => s.AddedSnapshotRules.Count > 0 || s.RemovedSnapshotRules.Count > 0)
|
||||
.Select(s => s.CreatedDateUtc)
|
||||
.OrderByDescending(s => s.Date)
|
||||
.FirstAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -26,6 +26,7 @@ public class ListDetailsDto
|
|||
public int RuleCount { get; set; }
|
||||
public string SubmissionUrl { get; set; }
|
||||
public ListSyntaxDto Syntax { get; set; }
|
||||
public DateTime? UpdatedDate { get; set; }
|
||||
public string ViewUrl { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -55,8 +55,9 @@ function ListInfo(props: any) {
|
|||
<ul className="list-group list-group-flush">
|
||||
<Languages languages={props.details.languages}/>
|
||||
<RuleCount count={props.details.ruleCount}/>
|
||||
<PublishedDate date={props.details.publishedDate}/>
|
||||
<DiscontinuedDate date={props.details.discontinuedDate}/>
|
||||
<UpdatedDate date={props.details.updatedDate}/>
|
||||
<PublishedDate date={props.details.publishedDate}/>
|
||||
<License license={props.details.license}/>
|
||||
</ul>
|
||||
</div>;
|
||||
|
|
@ -110,14 +111,6 @@ function RuleCount(props: any) {
|
|||
: null;
|
||||
}
|
||||
|
||||
function PublishedDate(props: any) {
|
||||
return props.date
|
||||
? <li className="list-group-item">
|
||||
<p>Published: {moment(props.date).format("MMM. D YYYY")}</p>
|
||||
</li>
|
||||
: null;
|
||||
}
|
||||
|
||||
function DiscontinuedDate(props: any) {
|
||||
return props.date
|
||||
? <li className="list-group-item">
|
||||
|
|
@ -126,6 +119,22 @@ function DiscontinuedDate(props: any) {
|
|||
: null;
|
||||
}
|
||||
|
||||
function UpdatedDate(props: any) {
|
||||
return props.date
|
||||
? <li className="list-group-item">
|
||||
<p>Updated: {moment(props.date).format("MMM. D YYYY")}</p>
|
||||
</li>
|
||||
: null;
|
||||
}
|
||||
|
||||
function PublishedDate(props: any) {
|
||||
return props.date
|
||||
? <li className="list-group-item">
|
||||
<p>Published: {moment(props.date).format("MMM. D YYYY")}</p>
|
||||
</li>
|
||||
: null;
|
||||
}
|
||||
|
||||
function License(props: any) {
|
||||
return props.license
|
||||
? (props.license.descriptionUrl
|
||||
|
|
@ -309,6 +318,7 @@ interface IFilterListDetailsDto {
|
|||
ruleCount: number;
|
||||
submissionUrl: string;
|
||||
syntax: IListSyntaxDto[];
|
||||
updatedDate: string;
|
||||
viewUrl: string;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue