OSDN Git Service

fix bug of new counting function.
[rec10/rec10-git.git] / 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