diff --git a/ref-test/app/models/dataset.py b/ref-test/app/models/dataset.py index 6a22da3..88dc05d 100644 --- a/ref-test/app/models/dataset.py +++ b/ref-test/app/models/dataset.py @@ -17,6 +17,7 @@ class Dataset(db.Model): id = db.Column(db.String(36), index=True, primary_key=True) name = db.Column(db.String(128), nullable=False) tests = db.relationship('Test', backref='dataset') + entries = db.relationship('Entry', backref='dataset') creator_id = db.Column(db.String(36), db.ForeignKey('user.id')) date = db.Column(db.DateTime, nullable=False) default = db.Column(db.Boolean, default=False, nullable=True) diff --git a/ref-test/app/models/entry.py b/ref-test/app/models/entry.py index 217f0b6..9fb9aba 100644 --- a/ref-test/app/models/entry.py +++ b/ref-test/app/models/entry.py @@ -2,6 +2,7 @@ from ..extensions import db, mail from ..tools.encryption import decrypt, encrypt from ..tools.logs import write from .test import Test +from .dataset import Dataset from flask_login import current_user from flask_mail import Message @@ -17,6 +18,7 @@ class Entry(db.Model): email = db.Column(db.String(128), nullable=False) club = db.Column(db.String(128), nullable=True) test_id = db.Column(db.String(36), db.ForeignKey('test.id')) + dataset_id = db.Column(db.String(36), db.ForeignKey('dataset.id')) user_code = db.Column(db.String(6), nullable=True) start_time = db.Column(db.DateTime, index=True, nullable=True) end_time = db.Column(db.DateTime, index=True, nullable=True)