changeset 141:2827664bb785

Randomize test objects submission time.
author Daniele Nicolodi <daniele@grinta.net>
date Sun, 16 Oct 2011 23:38:41 +0200
parents f3ee09b031dd
children 597c40c5719f
files src/ltpdarepo/admin.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ltpdarepo/admin.py	Sun Oct 16 23:38:32 2011 +0200
+++ b/src/ltpdarepo/admin.py	Sun Oct 16 23:38:41 2011 +0200
@@ -274,7 +274,6 @@
 
     nsecs = 100
     t0 = datetime(1970, 1, 1, 0, 0, 0)
-    submitted = datetime.utcnow() - timedelta(hours=3 * nobjs)
 
     for i in range(nobjs):
 
@@ -282,6 +281,7 @@
         title = ' '.join(words[0:2])
         description = random.choice(sentences)
         analysis = random.choice(sentences)
+        submitted = datetime.utcnow() - timedelta(days=random.randint(0, nobjs / 10.0))
 
         curs.execute("""INSERT INTO objs (uuid) VALUES (%s)""", (str(uuid.uuid4())))
         objid = curs.lastrowid
@@ -299,7 +299,7 @@
         curs.execute("""INSERT INTO tsdata (obj_id, fs, t0, nsecs)
                         VALUES (%s, %s, %s, %s)""", (objid, 10, t0, nsecs))
         t0 += timedelta(seconds=nsecs)
-        submitted += timedelta(hours=3)
+
     conn.commit()
 
 cmd = commands.add(populate)