rename updated to crawled to be more explicit

This commit is contained in:
Collin M. Barrett 2018-06-08 14:52:55 -05:00
parent 4fa79a1199
commit 449fec0c93
5 changed files with 14 additions and 14 deletions

View file

@ -20,8 +20,8 @@ public FilterListService(FilterListsDbContext dbContext) : base(dbContext)
public async Task<IEnumerable<ListSummaryDto>> GetAllSummariesAsync()
{
var summaries = await GetSummaryDtos();
var latestUpdatedSnapshots = await GetLatestUpdatedSnapshots();
return summaries.GroupJoin(latestUpdatedSnapshots, summary => summary.Id, snap => snap.FilterListId,
var latestSnapshots = await GetLatestSnapshots();
return summaries.GroupJoin(latestSnapshots, summary => summary.Id, snap => snap.FilterListId,
(summary, snap) =>
{
var snaps = snap as Data.Entities.Snapshot[] ?? snap.ToArray();
@ -29,9 +29,9 @@ public async Task<IEnumerable<ListSummaryDto>> GetAllSummariesAsync()
{
Id = summary.Id,
AddedDate = summary.AddedDate,
CrawledDate = snaps.Any() ? snaps.Single().CreatedDateUtc : (DateTime?) null,
Languages = summary.Languages,
Name = summary.Name,
UpdatedDate = snaps.Any() ? snaps.Single().CreatedDateUtc : (DateTime?) null,
ViewUrl = summary.ViewUrl
};
});
@ -45,7 +45,7 @@ private async Task<List<ListSummaryDto>> GetSummaryDtos()
.ToListAsync();
}
private async Task<List<Data.Entities.Snapshot>> GetLatestUpdatedSnapshots()
private async Task<List<Data.Entities.Snapshot>> GetLatestSnapshots()
{
return await DbContext.Snapshots.AsNoTracking()
.Where(snap =>
@ -63,7 +63,7 @@ public async Task<ListDetailsDto> GetDetailsAsync(int id)
.FirstAsync(x => x.Id == id)
.FilterParentListFromMaintainerAdditionalLists();
details.RuleCount = await GetActiveRuleCount(details);
details.UpdatedDate = await GetUpdatedDate(details);
details.CrawledDate = await GetCrawledDate(details);
return details;
}
@ -75,7 +75,7 @@ private async Task<int> GetActiveRuleCount(ListDetailsDto details)
await listSnapshots.SelectMany(sr => sr.RemovedSnapshotRules).CountAsync();
}
private async Task<DateTime?> GetUpdatedDate(ListDetailsDto details)
private async Task<DateTime?> GetCrawledDate(ListDetailsDto details)
{
var snapshotDates = DbContext.Snapshots.AsNoTracking()
.Where(s => s.FilterListId == details.Id && s.IsCompleted &&

View file

@ -10,6 +10,7 @@ public class ListDetailsDto
public int Id { get; set; }
public DateTime AddedDate { get; set; }
public string ChatUrl { get; set; }
public DateTime? CrawledDate { get; set; }
public string Description { get; set; }
public string DescriptionSourceUrl { get; set; }
public DateTime? DiscontinuedDate { get; set; }
@ -27,7 +28,6 @@ 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; }
}
}

View file

@ -9,9 +9,9 @@ public class ListSummaryDto
{
public int Id { get; set; }
public DateTime AddedDate { get; set; }
public DateTime? CrawledDate { get; set; }
public IEnumerable<ListLanguagesDto> Languages { get; set; }
public string Name { get; set; }
public DateTime? UpdatedDate { get; set; }
public string ViewUrl { get; set; }
}
}

View file

@ -95,7 +95,7 @@ export class Home extends React.Component<RouteComponentProps<{}>, IHomeState> {
},
{
Header: "Crawled",
accessor: "updatedDate",
accessor: "crawledDate",
filterable: true,
filterMethod: (filter: any, row: any) => row[filter.id].toUpperCase()
.includes(filter.value.toUpperCase()),
@ -166,9 +166,9 @@ export class Home extends React.Component<RouteComponentProps<{}>, IHomeState> {
interface IListDto {
id: number;
addedDate: string;
crawledDate: string;
name: string;
languages: IListLanguageDto[];
updatedDate: string;
viewUrl: string;
}

View file

@ -56,7 +56,7 @@ function ListInfo(props: any) {
<Languages languages={props.details.languages}/>
<RuleCount count={props.details.ruleCount}/>
<DiscontinuedDate date={props.details.discontinuedDate}/>
<UpdatedDate date={props.details.updatedDate}/>
<CrawledDate date={props.details.crawledDate}/>
<AddedDate date={props.details.addedDate}/>
<PublishedDate date={props.details.publishedDate}/>
<License license={props.details.license}/>
@ -120,10 +120,10 @@ function DiscontinuedDate(props: any) {
: null;
}
function UpdatedDate(props: any) {
function CrawledDate(props: any) {
return props.date
? <li className="list-group-item">
<p>Last Updated: {moment(props.date).format("MMM D, Y")}</p>
<p>Last Crawled: {moment(props.date).format("MMM D, Y")}</p>
</li>
: null;
}
@ -312,6 +312,7 @@ function MaintainerUrls(props: any) {
interface IFilterListDetailsDto {
addedDate: string;
chatUrl: string;
crawledDate: string;
description: string;
descriptionSourceUrl: string;
discontinuedDate: string;
@ -328,7 +329,6 @@ interface IFilterListDetailsDto {
ruleCount: number;
submissionUrl: string;
syntax: IListSyntaxDto[];
updatedDate: string;
viewUrl: string;
}