Ejemplo n.º 1
0
 def list_only_tags(self, taglist=None):
     df = pd.read_sql_query(f"SELECT * FROM {TABLE}", self.connection)
     df.replace(np.nan, "", inplace=True)
     df['alltags'] = df['tag1'].astype(str) + '_' + df['tag2'].astype(
         str) + '_' + df['tag3'].astype(str) + '_' + df['tag4'].astype(
             str) + '_' + df['tag5'].astype(str) + '_' + df['tag6'].astype(
                 str)
     for tag in taglist:
         df = df[df['alltags'].str.contains(tag)]  #add exit condition here
     prettyprint(df)
Ejemplo n.º 2
0
    def list_all_tags(self, taglist=None, due=None):
        taglist = list_to_sql_params(taglist)

        df = pd.read_sql_query(
            f'''SELECT * FROM {TABLE} WHERE  
                tag1 IN {taglist} OR
                tag2 IN {taglist} OR
                tag3 IN {taglist} OR
                tag4 IN {taglist} OR
                tag5 IN {taglist} OR
                tag6 IN {taglist};
                ''', self.connection)

        prettyprint(df)
        #concept code for checking due date
        #df['due_list'] = df['due'].apply(lambda x: parse_date(x) <=  parse_date('tomorrow'))
        prettyprint(filter_due_date(df, 'tomorrow'))
Ejemplo n.º 3
0
    def imperial(self):
        if (not self.unit) or (self.unit.conversion == 0L):
            return ""

        return "( %s %s )" % (prettyprint(self.unit.to_imperial(self.amount)), self.unit.imperial)
Ejemplo n.º 4
0
 def view_all(self):
     df = pd.read_sql_query(f"SELECT * FROM {TABLE}", self.connection)
     prettyprint(df)
Ejemplo n.º 5
0
 def metric(self):
     if self.unit:
         return " %s %s " % (prettyprint(self.amount), self.unit.metric)
     else:
         return prettyprint(self.amount)