changeset 132:aae5891e420d

Assign different submission time to test objects.
author Daniele Nicolodi <daniele@grinta.net>
date Fri, 14 Oct 2011 21:59:04 +0200
parents a4a1b9f582cd
children 2006f8a68358
files src/ltpdarepo/admin.py
diffstat 1 files changed, 14 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/ltpdarepo/admin.py	Fri Oct 14 11:05:31 2011 +0200
+++ b/src/ltpdarepo/admin.py	Fri Oct 14 21:59:04 2011 +0200
@@ -272,8 +272,9 @@
     words = re.split('\W+', lorem)
     sentences = [s + '.' for s in [s.strip() for s in lorem.split('.')] if s]
 
+    nsecs = 100
     t0 = datetime(1970, 1, 1, 0, 0, 0)
-    nsecs = 100
+    submitted = datetime.utcnow() - timedelta(hours=3 * nobjs)
 
     for i in range(nobjs):
 
@@ -284,20 +285,21 @@
 
         curs.execute("""INSERT INTO objs (uuid) VALUES (%s)""", (str(uuid.uuid4())))
         objid = curs.lastrowid
-        curs.execute("""INSERT INTO objmeta (obj_id, obj_type, name, created,
-                        version, ip, hostname, os, submitted,
-                        experiment_title, experiment_desc, analysis_desc,
-                        quantity, additional_authors, additional_comments,
-                        keywords, reference_ids, validated, vdate, author)
-                        VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
-                        %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
-                     (objid, 'ao', name, datetime.utcnow(),
-                      '0.1', '127.0.0.1', 'localhost', 'any', datetime.utcnow(),
-                      title, description, analysis, 'FOO', '', '',
-                      'testing', '', None, None, None))
+        curs.execute("""INSERT INTO objmeta (
+                          obj_id, obj_type, name, created, version, ip, hostname, os,
+                          submitted, experiment_title, experiment_desc, analysis_desc,
+                          quantity, additional_authors, additional_comments, keywords,
+                          reference_ids, validated, vdate, author)
+                        VALUES (
+                          %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
+                          %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
+                     (objid, 'ao', name, datetime.utcnow(), '0.1', '127.0.0.1', 'localhost', 'any',
+                      submitted, title, description, analysis, 'FOO', '', '', 'testing', '',
+                      None, None, None))
         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)