active tasks
This commit is contained in:
parent
8e75dbf40c
commit
a5f2f404b3
2 changed files with 17 additions and 2 deletions
7
model.py
7
model.py
|
@ -1,6 +1,7 @@
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
|
||||||
from abcex import Abcex
|
from abcex import Abcex
|
||||||
|
from params import Params
|
||||||
|
|
||||||
|
|
||||||
class Model:
|
class Model:
|
||||||
|
@ -9,6 +10,8 @@ class Model:
|
||||||
self.conn.row_factory = sqlite3.Row
|
self.conn.row_factory = sqlite3.Row
|
||||||
self.abcex = Abcex()
|
self.abcex = Abcex()
|
||||||
|
|
||||||
|
self.params = Params()
|
||||||
|
|
||||||
def get_tasks_by_tag(self, tag_name):
|
def get_tasks_by_tag(self, tag_name):
|
||||||
query = '''
|
query = '''
|
||||||
SELECT t.* FROM task t
|
SELECT t.* FROM task t
|
||||||
|
@ -21,11 +24,11 @@ class Model:
|
||||||
|
|
||||||
def get_all_tasks(self, done=False, active=False):
|
def get_all_tasks(self, done=False, active=False):
|
||||||
done_query = ''
|
done_query = ''
|
||||||
if done:
|
if done or self.params.get('done'):
|
||||||
done_query = 'AND t.done = 1'
|
done_query = 'AND t.done = 1'
|
||||||
|
|
||||||
active_query = ''
|
active_query = ''
|
||||||
if active:
|
if active or self.params.get('active'):
|
||||||
active_query = 'AND t.active = 1'
|
active_query = 'AND t.active = 1'
|
||||||
|
|
||||||
query = '''
|
query = '''
|
||||||
|
|
12
ztm.py
12
ztm.py
|
@ -1,3 +1,4 @@
|
||||||
|
import argparse
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from pyfzf.pyfzf import FzfPrompt
|
from pyfzf.pyfzf import FzfPrompt
|
||||||
|
@ -7,6 +8,7 @@ from task import Task
|
||||||
from tag import Tag
|
from tag import Tag
|
||||||
from config import Config
|
from config import Config
|
||||||
from bcolors import bcolors
|
from bcolors import bcolors
|
||||||
|
from params import Params
|
||||||
|
|
||||||
|
|
||||||
class Main:
|
class Main:
|
||||||
|
@ -15,9 +17,19 @@ class Main:
|
||||||
self.task = Task()
|
self.task = Task()
|
||||||
self.tag = Tag()
|
self.tag = Tag()
|
||||||
self.config = Config()
|
self.config = Config()
|
||||||
|
self.params = Params()
|
||||||
|
|
||||||
self.fzf = FzfPrompt()
|
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):
|
def run(self):
|
||||||
|
n = self.parser.parse_args()
|
||||||
|
if n.active:
|
||||||
|
self.params.update('active', True)
|
||||||
|
|
||||||
print(bcolors.HEADER + '''
|
print(bcolors.HEADER + '''
|
||||||
GEEEEEEEL .. :
|
GEEEEEEEL .. :
|
||||||
,##############Wf.,;;L#K;;. ,W, .Et
|
,##############Wf.,;;L#K;;. ,W, .Et
|
||||||
|
|
Reference in a new issue