コード例 #1
0
 def get_project_colors(cls):
     cursor = Database.find_db()
     # returns project colors by companies
     cursor.execute("SELECT main_color FROM project WHERE name IS NOT NULL ORDER BY name;")
     project_colors = []
     for i in cursor.fetchall():
         project_colors.append(list(i))
     for i, j in enumerate(project_colors):
         project_colors[i][0] = Database.hex_to_rgb(j[0])
     return project_colors
コード例 #2
0
 def get_budget_by_project(cls):
     cursor = Database.find_db()
     # projects witout name are removed
     cursor.execute("SELECT name, budget_value, budget_currency FROM project WHERE manager IS NOT NULL ORDER BY name;")
     budget_list = []
     for i in cursor.fetchall():
         budget_list.append(list(i))
     for i in budget_list:
         i[1] = "%.0f" % (Project.currency_conversion(i[2]) * float(i[1]))
         i[2] = "EUR"
     return budget_list
コード例 #3
0
 def get_project_colors(cls):
     cursor = Database.find_db()
     # returns project colors by companies
     cursor.execute("SELECT company_name, main_color FROM project ORDER BY company_name;")
     colors = cursor.fetchall()
     client_colors = []
     for i in colors:
         client_colors.append(list(i))
     for i, j in enumerate(client_colors):
         client_colors[i][1] = Database.hex_to_rgb(j[1])
     return client_colors
コード例 #4
0
 def is_maintenance_requested(cls):
     # returns list of boolean values
     cursor = Database.find_db()
     # projects without names are removed
     cursor.execute("SELECT maintenance_requested FROM project WHERE name IS NOT NULL ORDER BY name")
     maintenance_requested = []
     for i in cursor.fetchall():
         if i[0] == 'true':
             maintenance_requested.append(True)
         else:
             maintenance_requested.append(False)
     return maintenance_requested
コード例 #5
0
 def get_manager_names_and_companies(cls):
     cursor = Database.find_db()
     cursor.execute("SELECT manager, company_name FROM project WHERE manager IS NOT NULL ORDER BY name;")
     managers = cursor.fetchall()
     return managers
コード例 #6
0
 def get_project_duedates(cls):
     cursor = Database.find_db()
     cursor.execute("SELECT duedate FROM project WHERE name IS NOT NULL ORDER BY name;")
     project_duedates = []
     return cursor.fetchall()
コード例 #7
0
 def get_client_and_number_of_projects(cls):
     cursor = Database.find_db()
     cursor.execute("""SELECT company_name, COUNT(company_name)
                           FROM project GROUP BY company_name ORDER BY company_name;""")
     rows = cursor.fetchall()
     return rows