mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-23 23:20:57 +03:00
Include never played songs in the "not in the last" operator
This commit is contained in:
parent
2b57b98a4b
commit
947353610c
@ -183,7 +183,10 @@ func (r dateRule) inTheLast(invert bool) (Sqlizer, error) {
|
||||
}
|
||||
period := time.Now().Add(time.Duration(-24*v) * time.Hour)
|
||||
if invert {
|
||||
return Lt{r.Field: period}, nil
|
||||
return Or{
|
||||
Lt{r.Field: period},
|
||||
Eq{r.Field: nil},
|
||||
}, nil
|
||||
}
|
||||
return Gt{r.Field: period}, nil
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ var _ = Describe("smartPlaylist", func() {
|
||||
Expect(args).To(ConsistOf(BeTemporally("~", expectedValue, delta)))
|
||||
},
|
||||
Entry("in the last", "in the last", "lastPlayed > ?", date.Add(-90*24*time.Hour)),
|
||||
Entry("not in the last", "not in the last", "lastPlayed < ?", date.Add(-90*24*time.Hour)),
|
||||
Entry("not in the last", "not in the last", "(lastPlayed < ? OR lastPlayed IS NULL)", date.Add(-90*24*time.Hour)),
|
||||
)
|
||||
|
||||
It("accepts string as the 'in the last' operator value", func() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user