# HG changeset patch # User shinysky # Date 1280150141 -28800 # Node ID 96e29ff5fa07bf3cb60f75dcfee622256fc6c263 # Parent de71a52fc63a676e6918f29313bb1c2f471afe9f mod_archive: keep collections in chronological order. diff -r de71a52fc63a -r 96e29ff5fa07 mod_archive/mod_archive.lua --- a/mod_archive/mod_archive.lua Sun Jul 25 20:55:04 2010 +0800 +++ b/mod_archive/mod_archive.lua Mon Jul 26 21:15:41 2010 +0800 @@ -70,15 +70,15 @@ end end else -- if the last collection occurs on the same day, then join it - -- TODO assuming the collection list are in reverse chronological order - local collection = st.deserialize(data[1]); + -- TODO assuming the collection list are in chronological order + local collection = st.deserialize(data[#data]); local difftime = os.difftime(date_parse(utc), date_parse(collection.attr["start"])); if difftime < 86400 then -- 60 * 60 * 24 collection:tag(tag, {secs='1', utc=utc}):add_child(body); local ver = tonumber(collection.attr["version"]) + 1; collection.attr["version"] = tostring(ver); collection.attr["access"] = utc; - data[1] = collection; + data[#data] = collection; dm.list_store(node, host, ARCHIVE_DIR, st.preserialize(data)); return; end