OSDN Git Service

fix bug of new counting function.
authorgn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Mon, 24 Aug 2009 08:48:23 +0000 (08:48 +0000)
committergn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Mon, 24 Aug 2009 08:48:23 +0000 (08:48 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@134 4e526526-5e11-4fc0-8910-f8fd03428081

Rec10WEB/trunk/src/rec10web.py

index 2dbf539..1491f4f 100644 (file)
@@ -153,9 +153,17 @@ def count_schedule(btime,etime):
     dls=database.schedule_rectime(btime,etime)
     print dls
     times=[]
+    btd=datetime.datetime(*time.strptime(btime,"%Y-%m-%d %H:%M:%S")[:-3])
+    etd=datetime.datetime(*time.strptime(etime,"%Y-%m-%d %H:%M:%S")[:-3])
     for dl in dls:
-        times.append(datetime.datetime(*time.strptime(dl[4],"%Y-%m-%d %H:%M:%S")[:-3]))
-        times.append(datetime.datetime(*time.strptime(dl[5],"%Y-%m-%d %H:%M:%S")[:-3]))
+        dd1=datetime.datetime(*time.strptime(dl[4],"%Y-%m-%d %H:%M:%S")[:-3])
+        dd2=datetime.datetime(*time.strptime(dl[5],"%Y-%m-%d %H:%M:%S")[:-3])
+        if dd1<btd:
+            dd1=btd
+        if dd2>etd:
+            dd2=etd
+        times.append(dd1)
+        times.append(dd2)
     print times
     times=list(set(times))
     print times