Пример #1
0
 def GetDataframe(self):
     
                        
     run_id = tableRuns.run_id        
     row_id = 1
     rows = []
     
     
     row = {}
     row["id"] = row_id
     row["name"] = "Run id:"+ str(run_id)
     row["startlist"] = 0 #tableUsers.getCount()  
     row["dns"] = 0#tableUsers.getCount("dns")          
     row["finished"] = 0#tableUsers.getCount("finished")
     row["dq"] = 0#tableUsers.getCount("dq")  
     row["dnf"] = 0#tableUsers.getCount("dnf")
     row["race"] = 0#tableUsers.getCount("race") 
     
     
     if row["startlist"] ==  row["dns"] + row["finished"] + row["dq"] + row["dnf"] + row["race"]:
        row["check"] = "ok"
     else:
         row["check"] = "ko"        
          
     rows.append(row)
     row_id =  row_id + 1        
      
     #categories
     dbCategories = tableCategories.getDbRows()                      
     for dbCategory in dbCategories:                                                                                            
          
         #row = self.db2tableRow(row)
         row = {}
         row["id"] = row_id
         row["name"] = dbCategory["name"]                        
         row["startlist"] = 0# tableUsers.getCount(dbCategory = dbCategory)  
         row["dns"] = 0# tableUsers.getCount("dns", dbCategory)              
         row["finished"] = 0# tableUsers.getCount("finish", dbCategory)
         row["dq"] = 0# tableUsers.getCount("dq", dbCategory)  
         row["dnf"] = 0# tableUsers.getCount("dnf", dbCategory)              
         row["race"] = 0# tableUsers.getCount("race", dbCategory)
          
         if row["startlist"] ==  row["dns"] + row["finished"] + row["dq"] + row["dnf"] + row["race"]:
             row["check"] = "ok"
         else:
             row["check"] = "ko"                          
                
         rows.append(row)
         row_id =  row_id + 1                     
     
     
     df = pd.DataFrame(rows)        
     return df                    
Пример #2
0
    def Update(self, parameter=None, value=None):
        """
        Update model z databaze
          
        Update() => update cele tabulky
        Update(parameter, value) => vsechny radky s parametrem = value
        Update(conditions, operation) => condition[0][0]=condition[0][1] OPERATION condition[1][0]=condition[1][1]                 
        """                                

        #disable user actions        
        dstore.Set("user_actions", dstore.Get("user_actions")+1)          
                      
        #smazat vsechny radky
        self.removeRows(0, self.rowCount())                                                                                                                                              
        
        row_id = 1
                        
        #row_table = self.db2tableRow(row)
        row_table = {}
        row_table["id"] = row_id
        row_table["name"] = "Run id:"#+ str(run_id)
        row_table["startlist"] = 0 #tableUsers.getCount()  
        row_table["dns"] = 0#tableUsers.getCount("dns")          
        row_table["finished"] = 0#tableUsers.getCount("finished")
        row_table["dq"] = 0#tableUsers.getCount("dq")  
        row_table["dnf"] = 0#tableUsers.getCount("dnf")
        row_table["race"] = 0#tableUsers.getCount("race")              
                                            
        if row_table["startlist"] ==  row_table["dns"] + row_table["finished"] + row_table["dq"] + row_table["dnf"] + row_table["race"]:
            row_table["check"] = "ok"
        else:
            row_table["check"] = "ko"        
            
        self.addRow(row_table)
        row_id =  row_id + 1
        
        #categories
        dbCategories = tableCategories.getDbRows()                      
        for dbCategory in dbCategories:                                                                                            
            
            #row_table = self.db2tableRow(row)
            row_table = {}
            row_table["id"] = row_id
            row_table["name"] = dbCategory["name"]                        
            row_table["startlist"] = 0# tableUsers.getCount(dbCategory = dbCategory)  
            row_table["dns"] = 0# tableUsers.getCount("dns", dbCategory)              
            row_table["finished"] = 0# tableUsers.getCount("finish", dbCategory)
            row_table["dq"] = 0# tableUsers.getCount("dq", dbCategory)  
            row_table["dnf"] = 0# tableUsers.getCount("dnf", dbCategory)              
            row_table["race"] = 0# tableUsers.getCount("race", dbCategory)
            
            if row_table["startlist"] ==  row_table["dns"] + row_table["finished"] + row_table["dq"] + row_table["dnf"] + row_table["race"]:
                row_table["check"] = "ok"
            else:
                row_table["check"] = "ko"                          
                  
            self.addRow(row_table)
            row_id =  row_id + 1                     
        
        #enable user actions                                                                                                                                                                                                           
        dstore.Set("user_actions", dstore.Get("user_actions")-1)