Skip to content

Commit

Permalink
Extract and order the RSS threadmark list by published date rather th…
Browse files Browse the repository at this point in the history
…an assume

that the last in the list is the latest.  This fixes the issue of the
threadmarks being reordered to have the most recent one at the top.
  • Loading branch information
Kinematics committed Apr 16, 2018
1 parent 3d1e151 commit 8d017d1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions NetTally.Core/Input/Forums/Adapters/XenForo1Adapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,16 @@ public async Task<ThreadRangeInfo> GetStartingPostNumberAsync(IQuest quest, IPag
var items = channel.Elements(itemName);

XName titleName = XName.Get("title", "");
XName pubDate = XName.Get("pubDate", "");

var filteredItems = from item in items
let title = item.Element(titleName).Value
where !((quest.UseCustomThreadmarkFilters && quest.ThreadmarkFilter.Match(title)) ||
(!quest.UseCustomThreadmarkFilters && DefaultThreadmarkFilter.Match(title)))
let pub = item.Element(pubDate).Value
where string.IsNullOrEmpty(pub) == false
let pubStamp = DateTime.Parse(pub)
orderby pubStamp
select item;

var lastItem = filteredItems.LastOrDefault();
Expand Down

0 comments on commit 8d017d1

Please sign in to comment.