pull in even longer ago long ago honks
Ted Unangst tedu@tedunangst.com
Thu, 10 Feb 2022 20:30:39 -0500
1 files changed,
10 insertions(+),
6 deletions(-)
jump to
M
database.go
→
database.go
@@ -243,12 +243,16 @@ return getsomehonks(rows, err)
} func gethonksfromlongago(userid int64, wanted int64) []*Honk { now := time.Now().UTC() - now = time.Date(now.Year()-1, now.Month(), now.Day(), now.Hour(), now.Minute(), - now.Second(), 0, now.Location()) - dt1 := now.Add(-36 * time.Hour).Format(dbtimeformat) - dt2 := now.Add(12 * time.Hour).Format(dbtimeformat) - rows, err := stmtHonksFromLongAgo.Query(wanted, userid, dt1, dt2, userid) - return getsomehonks(rows, err) + var honks []*Honk + for i := 1; i <= 3; i++ { + dt := time.Date(now.Year()-i, now.Month(), now.Day(), now.Hour(), now.Minute(), + now.Second(), 0, now.Location()) + dt1 := dt.Add(-36 * time.Hour).Format(dbtimeformat) + dt2 := dt.Add(12 * time.Hour).Format(dbtimeformat) + rows, err := stmtHonksFromLongAgo.Query(wanted, userid, dt1, dt2, userid) + honks = append(honks, getsomehonks(rows, err)...) + } + return honks } func getsavedhonks(userid int64, wanted int64) []*Honk { rows, err := stmtHonksISaved.Query(wanted, userid)