Compare commits

..

1 Commits

2 changed files with 1 additions and 25 deletions

View File

@ -5,7 +5,6 @@
- (fix) relative article links (thanks to @adazsko for the report) - (fix) relative article links (thanks to @adazsko for the report)
- (fix) atom article links stored in id element (thanks to @adazsko for the report) - (fix) atom article links stored in id element (thanks to @adazsko for the report)
- (fix) parsing atom feed titles (thanks to @wnh) - (fix) parsing atom feed titles (thanks to @wnh)
- (fix) sorting same-day batch articles (thanks to @lamescholar for the report)
# v2.4 (2023-08-15) # v2.4 (2023-08-15)

View File

@ -4,7 +4,6 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"log" "log"
"sort"
"strings" "strings"
"time" "time"
@ -76,25 +75,6 @@ type MarkFilter struct {
Before *time.Time Before *time.Time
} }
type ItemList []Item
func (list ItemList) Len() int {
return len(list)
}
func (list ItemList) SortKey(i int) string {
return list[i].Date.Format(time.RFC3339) + "::" + list[i].GUID
}
func (list ItemList) Less(i, j int) bool {
return list.SortKey(i) < list.SortKey(j)
}
func (list ItemList) Swap(i, j int) {
list[i], list[j] = list[j], list[i]
}
func (s *Storage) CreateItems(items []Item) bool { func (s *Storage) CreateItems(items []Item) bool {
tx, err := s.db.Begin() tx, err := s.db.Begin()
if err != nil { if err != nil {
@ -104,10 +84,7 @@ func (s *Storage) CreateItems(items []Item) bool {
now := time.Now().UTC() now := time.Now().UTC()
itemsSorted := ItemList(items) for _, item := range items {
sort.Sort(itemsSorted)
for _, item := range itemsSorted {
_, err = tx.Exec(` _, err = tx.Exec(`
insert into items ( insert into items (
guid, feed_id, title, link, date, guid, feed_id, title, link, date,