0
我試圖找回自從有了這個過濾特定日期時間編輯的所有項目:波迪奧API last_edit_on過濾怪異的行爲
last_sync = DateTime.new(...)
filters = {last_edit_on: {from: last_sync}}
Podio::Item.find_by_filter_values(app_id, filters).all
這個過濾器不工作,我測試了不同的值,看看它是否是一個時間抵消問題。
filters = {last_edit_on: {from: 1.hour.from_now}}
Podio::Item.find_by_filter_values(app_id, filters).all.count # > 0
非零計數,儘管在將來編輯項目是沒有意義的。我甚至嘗試過相對的價值觀,並且我仍然會在未來獲得帶有last_edit_on的物品。
filters = {last_edit_on: {from: '+0d', to: '+1d'}}
Podio::Item.find_by_filter_values(app_id, filters).all.count # > 0
如果我有進一步的幾次都是{from: '+1d', to: '+2d'}
或 {from: 2.days.from_now}
篩選,我終於有一個零計數,這讓我覺得我用正確此過濾器。
我缺少的東西還是有在last_edit_on過濾系統的問題嗎?
感謝您的例子,這是我用它的方式。但是,當我使用{from:'-1d',到:'+ 0d'}時,我在2天前修改了項目,因此看起來很糟糕。甚至當我從未來要求last_edit_on的項目。 – TripleH
這可能是關於'+ 0d'和'-0d'的不同思維方式:) –