فهرست منبع

implemented to_date file indexing

Gamaliel Espinoza 8 سال پیش
والد
کامیت
a82420115e
3فایلهای تغییر یافته به همراه17 افزوده شده و 7 حذف شده
  1. 1 1
      tools/fourier/__init__.py
  2. 15 5
      tools/fourier/cli.py
  3. 1 1
      tools/fourier/migrations.py

+ 1 - 1
tools/fourier/__init__.py

@@ -1 +1 @@
-__version__ = '1.0.6'
+__version__ = '1.0.7'

+ 15 - 5
tools/fourier/cli.py

@@ -58,9 +58,14 @@ def main():
     
     dbparser = subparsers.add_parser('db')
     dbparser.add_argument('action')
-    dbparser.add_argument('-from-date', dest='from_date',
-                                        type=simple_date,
-                                        )
+    dbparser.add_argument('-from-date',
+                          dest='from_date',
+                          type=simple_date,
+                          )
+    dbparser.add_argument('-to-date',
+                          dest='to_date',
+                          type=simple_date,
+                          )
     dbparser.add_argument('-station', dest='station')
     dbparser.add_argument('--dry-run', dest='dry_run',
                           action='store_const',
@@ -119,8 +124,13 @@ def main():
                         '%Y-%m-%dT%H-%M-%S'
                     )
                     try:
-                        if args.from_date:
-                            do_insert = dt >= args.from_date  
+                        if args.from_date and args.to_date:
+                            do_insert = dt >= args.from_date\
+                                    and dt <= args.to_date
+                        elif args.from_date:
+                            do_insert = dt >= args.from_date
+                        elif args.to_date:
+                            do_insert = dt <= args.to_date
                         else:
                             do_insert = True
 

+ 1 - 1
tools/fourier/migrations.py

@@ -5,6 +5,6 @@ versions = [
             "create table config(name text primary key, value text)",
             "insert into config (name, value) values ('version', '1')",
             'create table "station"(remote_id text, indice int, status int)'
-        ],
+        ]
     ),
 ]