active tasks

This commit is contained in:
Arnas Udovicius 2018-03-09 22:17:45 +02:00
parent 8e75dbf40c
commit a5f2f404b3
2 changed files with 17 additions and 2 deletions

View file

@ -1,6 +1,7 @@
import sqlite3
from abcex import Abcex
from params import Params
class Model:
@ -9,6 +10,8 @@ class Model:
self.conn.row_factory = sqlite3.Row
self.abcex = Abcex()
self.params = Params()
def get_tasks_by_tag(self, tag_name):
query = '''
SELECT t.* FROM task t
@ -21,11 +24,11 @@ class Model:
def get_all_tasks(self, done=False, active=False):
done_query = ''
if done:
if done or self.params.get('done'):
done_query = 'AND t.done = 1'
active_query = ''
if active:
if active or self.params.get('active'):
active_query = 'AND t.active = 1'
query = '''

12
ztm.py
View file

@ -1,3 +1,4 @@
import argparse
import sys
from pyfzf.pyfzf import FzfPrompt
@ -7,6 +8,7 @@ from task import Task
from tag import Tag
from config import Config
from bcolors import bcolors
from params import Params
class Main:
@ -15,9 +17,19 @@ class Main:
self.task = Task()
self.tag = Tag()
self.config = Config()
self.params = Params()
self.fzf = FzfPrompt()
self.parser = argparse.ArgumentParser('ztm')
self.parser.add_argument('-c', '--current', dest='active', action='store_true')
self.parser.set_defaults(active=False)
def run(self):
n = self.parser.parse_args()
if n.active:
self.params.update('active', True)
print(bcolors.HEADER + '''
GEEEEEEEL .. :
,##############Wf.,;;L#K;;. ,W, .Et