pull in even longer ago long ago honks

This commit is contained in:
Ted Unangst 2022-02-10 20:30:39 -05:00
parent add60c10e8
commit d272b8110a
1 changed files with 10 additions and 6 deletions

View File

@ -243,12 +243,16 @@ func gethonksforme(userid int64, wanted int64) []*Honk {
} }
func gethonksfromlongago(userid int64, wanted int64) []*Honk { func gethonksfromlongago(userid int64, wanted int64) []*Honk {
now := time.Now().UTC() now := time.Now().UTC()
now = time.Date(now.Year()-1, now.Month(), now.Day(), now.Hour(), now.Minute(), 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()) now.Second(), 0, now.Location())
dt1 := now.Add(-36 * time.Hour).Format(dbtimeformat) dt1 := dt.Add(-36 * time.Hour).Format(dbtimeformat)
dt2 := now.Add(12 * time.Hour).Format(dbtimeformat) dt2 := dt.Add(12 * time.Hour).Format(dbtimeformat)
rows, err := stmtHonksFromLongAgo.Query(wanted, userid, dt1, dt2, userid) rows, err := stmtHonksFromLongAgo.Query(wanted, userid, dt1, dt2, userid)
return getsomehonks(rows, err) honks = append(honks, getsomehonks(rows, err)...)
}
return honks
} }
func getsavedhonks(userid int64, wanted int64) []*Honk { func getsavedhonks(userid int64, wanted int64) []*Honk {
rows, err := stmtHonksISaved.Query(wanted, userid) rows, err := stmtHonksISaved.Query(wanted, userid)