revert crawled back to updated

crawls happen more frequently, this date is the last time a crawl found a change
This commit is contained in:
Collin M. Barrett 2018-06-08 15:09:23 -05:00
parent f437f7eef5
commit f6dce9bc0d
5 changed files with 13 additions and 13 deletions

View file

@ -25,14 +25,14 @@ public async Task<IEnumerable<ListSummaryDto>> GetAllSummariesAsync()
(summary, snap) =>
{
snap = snap as Data.Entities.Snapshot[] ?? snap.ToArray();
var crawledDate = snap.Any() ? snap.Single().CreatedDateUtc : (DateTime?) null;
var updatedDate = snap.Any() ? snap.Single().CreatedDateUtc : (DateTime?) null;
return new ListSummaryDto
{
Id = summary.Id,
AddedDate = summary.AddedDate,
CrawledDate = crawledDate,
Languages = summary.Languages,
Name = summary.Name,
UpdatedDate = updatedDate,
ViewUrl = summary.ViewUrl
};
});
@ -64,7 +64,7 @@ public async Task<ListDetailsDto> GetDetailsAsync(int id)
.FirstAsync(x => x.Id == id)
.FilterParentListFromMaintainerAdditionalLists();
details.RuleCount = await GetActiveRuleCount(details);
details.CrawledDate = await GetCrawledDate(details);
details.UpdatedDate = await GetUpdatedDate(details);
return details;
}
@ -76,7 +76,7 @@ private async Task<int> GetActiveRuleCount(ListDetailsDto details)
await listSnapshots.SelectMany(sr => sr.RemovedSnapshotRules).CountAsync();
}
private async Task<DateTime?> GetCrawledDate(ListDetailsDto details)
private async Task<DateTime?> GetUpdatedDate(ListDetailsDto details)
{
var snapshotDates = DbContext.Snapshots.AsNoTracking()
.Where(s => s.FilterListId == details.Id &&

View file

@ -10,7 +10,6 @@ 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; }
@ -28,6 +27,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; }
}
}

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

@ -94,8 +94,8 @@ export class Home extends React.Component<RouteComponentProps<{}>, IHomeState> {
className: "d-none d-sm-block"
},
{
Header: "Crawled",
accessor: "crawledDate",
Header: "Updated",
accessor: "updatedDate",
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}/>
<CrawledDate date={props.details.crawledDate}/>
<UpdatedDate date={props.details.updatedDate}/>
<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 CrawledDate(props: any) {
function UpdatedDate(props: any) {
return props.date
? <li className="list-group-item">
<p>Last Crawled: {moment(props.date).format("MMM D, Y")}</p>
<p>Last Updated by Maintainer: {moment(props.date).format("MMM D, Y")}</p>
</li>
: null;
}
@ -312,7 +312,6 @@ function MaintainerUrls(props: any) {
interface IFilterListDetailsDto {
addedDate: string;
chatUrl: string;
crawledDate: string;
description: string;
descriptionSourceUrl: string;
discontinuedDate: string;
@ -329,6 +328,7 @@ interface IFilterListDetailsDto {
ruleCount: number;
submissionUrl: string;
syntax: IListSyntaxDto[];
updatedDate: string;
viewUrl: string;
}