class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(80), unique=True) email = db.Column(db.String(120), unique=True) password_hash = db.Column(db.String) is_admin = db.Column(db.Boolean(), default=False) issue = db.relationship("Issue", backref='user', lazy='dynamic') @property def password(self): raise AttributeError('Password: write only field') @password.setter def password(self, password): self.password_hash = generate_password_hash(password) def check_password(self, password): return check_password_hash(self.password_hash, password) @staticmethod def get_by_username(username): return User.query.filter_by(username=username).first() @staticmethod def get_username_by_id(id): return User.query.filter_by(id=id).first().username def __repr__(self): return f'<User {self.username}>' @staticmethod def all_of_users(): return User.query.order_by(desc(User.id))
class Issue(db.Model): id = db.Column(db.Integer, primary_key=True) date = db.Column(db.String, default=(datetime.utcnow().strftime("%m/%d/%Y"))) title = db.Column(db.String) description = db.Column(db.String) status = db.Column(db.String) severity = db.Column(db.String) spice_process = db.Column(db.String) link = db.Column(db.String, default='') user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False) comments = db.relationship("Comment", backref='Issue', lazy='dynamic')
class Project(db.Model): id = db.Column(db.Integer, primary_key=True) start_date = db.Column(db.String) end_date = db.Column(db.String) name = db.Column(db.String) gate_1 = db.Column(db.String) gate_2 = db.Column(db.String) gate_3 = db.Column(db.String) sop = db.Column(db.String) spice_level = db.Column(db.String) @staticmethod def get_project(): return Project.query.first()
class Documents(db.Model): id = db.Column(db.Integer, primary_key=True) sw_strategy = db.Column(db.String) sys_strategy = db.Column(db.String) test_strategy = db.Column(db.String)
class Comment(db.Model): item_id = db.Column(db.Integer, primary_key=True) date = db.Column(db.String, default=(datetime.utcnow().strftime("%m/%d/%Y"))) content = db.Column(db.String(256)) issue_id = db.Column(db.Integer, db.ForeignKey('issue.id'), nullable=False)
class Workbook(db.Model): id = db.Column(db.Integer, primary_key=True) cw = db.Column(db.String) total_client_req = db.Column(db.Integer) total_client_req_approved = db.Column(db.Integer) total_open_issue_client_req = db.Column(db.Integer) total_sys_req = db.Column(db.Integer) total_sys_req_approved = db.Column(db.Integer) total_sys_req_implemented = db.Column(db.Integer) total_sw_req = db.Column(db.Integer) total_sw_req_approved = db.Column(db.Integer) total_sw_req_implemented = db.Column(db.Integer) ccm_more_50 = db.Column(db.Integer) ccm_24_50 = db.Column(db.Integer) ccm_12_24 = db.Column(db.Integer) misra_high = db.Column(db.Integer) misra_mid = db.Column(db.Integer) misra_low = db.Column(db.Integer) branch_coverage = db.Column(db.Float) line_coverage = db.Column(db.Float) mc_dc_coverage = db.Column(db.Float) total_sw_req_tests = db.Column(db.Integer) total_sw_req_passed = db.Column(db.Integer) total_sys_req_tests = db.Column(db.Integer) total_sys_req_tests_passed = db.Column(db.Integer) traceability_sys_client = db.Column(db.Integer) traceability_client_sys = db.Column(db.Integer) traceability_sys_sw = db.Column(db.Integer) traceability_sw_sys = db.Column(db.Integer) total_features = db.Column(db.Integer) total_bugs = db.Column(db.Integer) total_bugs_solved = db.Column(db.Integer) total_problems = db.Column(db.Integer) total_problems_solved = db.Column(db.Integer) total_change_requests = db.Column(db.Integer) change_request_not_reviewed = db.Column(db.Integer) @staticmethod def all_of_workbooks(): return Workbook.query.order_by(desc(Workbook.cw)) @staticmethod def workbook_query(): return Workbook.query.all() @staticmethod def get_metric_by_id(idx): return Workbook.query.get_or_404(idx)
class Gate0(db.Model): id = db.Column(db.Integer, primary_key=True) date = db.Column(db.String, default=(datetime.utcnow().strftime("%m/%d/%Y"))) sw_strategy = db.Column(db.String) sys_strategy = db.Column(db.String) test_strategy = db.Column(db.String)
class SOP(Gate2): is_ready = db.Column(db.String)
class Gate2(Gate1): test_question2 = db.Column(db.String)
class Gate1(Gate0): test_report = db.Column(db.String)