Skip to content
Snippets Groups Projects

Resolve "CREATE_SURVEY"

Merged Helena Dypvik Skants requested to merge 6-create-reflection into 6-create_survey
5 files
+ 127
0
Compare changes
  • Side-by-side
  • Inline
Files
5
+ 18
0
@@ -5,6 +5,8 @@ from sqlalchemy.orm import Session
from . import model, schemas
def get_user(db: Session, user_email: str):
return db.query(model.User).filter(model.User.email == user_email).first()
@@ -43,8 +45,24 @@ def create_question(db: Session, question: str, comment: str):
db.refresh(db_obj)
return db_obj
def create_course(db: Session, course: schemas.CourseCreate):
db_course = model.Course(**course)
questions = [
create_question(
db=db,
question="Teaching",
comment="What did you learn in this unit? What was your best learning achievement?",
),
create_question(
db=db,
question="Difficult",
comment="What was difficult in this unit? Was there a concept that you struggled with the most, or something that you found unclear?",
),
]
for q in questions:
db_course.questions.append(q)
print("creating course")
db.add(db_course)
db.commit()
Loading