Changeset

224:96e29ff5fa07

mod_archive: keep collections in chronological order.
author shinysky<shinysky1986(AT)gmail.com>
date Mon, 26 Jul 2010 21:15:41 +0800
parents 223:de71a52fc63a
children 225:95d4d53f09a1
files mod_archive/mod_archive.lua
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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