Przeglądaj źródła

Create projects

https
jakobsn 6 lat temu
rodzic
commit
8322ac055a
4 zmienionych plików z 14 dodań i 9 usunięć
  1. +2
    -2
      mysql/sql/init.sql
  2. +8
    -0
      src/app/models/project.py
  3. +1
    -1
      src/app/templates/my_projects.html
  4. +3
    -6
      src/app/views/project.py

+ 2
- 2
mysql/sql/init.sql Wyświetl plik

@@ -78,8 +78,8 @@ CREATE TABLE projects_users (

CREATE TABLE tasks (
taskid INT UNSIGNED AUTO_INCREMENT,
projectid INT NOT NULL,
teamid INT UNSIGNED NOT NULL,
projectid UNSIGNED INT NOT NULL,
teamid INT UNSIGNED,
title VARCHAR(200) NOT NULL,
task_description VARCHAR(500),
budget INT,


+ 8
- 0
src/app/models/project.py Wyświetl plik

@@ -26,3 +26,11 @@ def get_projects_by_status_and_category(categoryid, project_status):
cursor.execute(query)
projects = cursor.fetchall()
return projects

def set_waiting_task(projectid, title, task_description, budget):
cursor = db.cursor()
query = ("INSERT INTO tasks (pjojectid, title, task_description, budget) VALUES (\"" +
projectid + "\", \"" + title + "\", \"" + title + "\", \"" +
task_description + "\", \"" + budget + "\")")
cursor.execute(query)


+ 1
- 1
src/app/templates/my_projects.html Wyświetl plik

@@ -15,7 +15,7 @@ $def with (nav, categories, open_projects)
<div class="categories">
$for category in categories:
<div class="category" onclick="location.href='/?categoryid=$category[0]'">$category[1]</div>
<div class="category" onclick="location.href='/my_projects?categoryid=$category[0]'">$category[1]</div>
</div>

<div class="projects">


+ 3
- 6
src/app/views/project.py Wyświetl plik

@@ -38,7 +38,8 @@ class Project:
try:
if data["Create Project"]:
print("Create")
pass
models.project.set_waiting_task
else:
pass
except Exception as e:
@@ -50,7 +51,7 @@ class Project:

def get_task_count(self, data):
task_count = 0
print(len(data))
# Remove the four other elements from count and divide by the number of variables in one task.
task_count = int((len(data) - 4) / 3)
"""while True:
try:
@@ -64,18 +65,14 @@ class Project:
def compose_form(self, data, add):
task_count = self.get_task_count(data)
# A task is either added or removed
print("init count", task_count)
if not add and task_count >= 1:
task_count -= 1

print("modded", task_count)
project_form_elements = get_project_form_elements(data.project_title, data.project_description, data.category_name)
task_form_elements = ()
old_task_form_element = ()

for i in range(0, task_count):
print(i, data)
old_task_form_element = get_task_form_elements(i, data["task_title_"+str(i)],
data["task_description_"+str(i)], data["budget_"+str(i)])
task_form_elements = (task_form_elements + old_task_form_element)


Ładowanie…
Anuluj
Zapisz