Coverage for src/model/event/recommendation_launched_for_profile_event.py : 100%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1from datetime import datetime
3from src import db
4from ..content_model import ContentType
7class RecoLaunchedLikedGenreModel(db.Model):
8 """ Copy of interest for the recommendation history """
9 __tablename__ = "recommendation_launched_liked_genre"
11 event_id = db.Column(db.Integer, db.ForeignKey(
12 "recommendation_launched_for_profile_event.id", ondelete="CASCADE"), primary_key=True)
13 genre_id = db.Column(db.Integer, primary_key=True)
14 name = db.Column(db.String(45))
15 content_type = db.Column(db.Enum(ContentType))
18class RecoMetaModel(db.Model):
19 """ Copy of meta for the recommendation history """
20 __tablename__ = "recommendation_launched_meta"
22 event_id = db.Column(db.Integer, db.ForeignKey(
23 "recommendation_launched_for_profile_event.id", ondelete="CASCADE"), primary_key=True)
24 content_id = db.Column(db.Integer, db.ForeignKey(
25 "content.content_id", ondelete="CASCADE"), primary_key=True)
26 rating = db.Column(db.Integer, default=None)
27 last_rating_date = db.Column(db.DateTime, default=None)
28 review_see_count = db.Column(db.Integer, default=0)
29 last_review_see_date = db.Column(db.DateTime, default=None)
30 count = db.Column(db.Integer, default=0)
31 last_count_increment = db.Column(db.DateTime, default=None)
34class RecoResultModel(db.Model):
35 """ Result recommendation history for the event"""
36 __tablename__ = "recommendation_launched_result"
38 event_id = db.Column(db.Integer, db.ForeignKey(
39 "recommendation_launched_for_profile_event.id", ondelete="CASCADE"), primary_key=True)
40 content_id = db.Column(db.Integer, db.ForeignKey(
41 "content.content_id", ondelete="CASCADE"), primary_key=True)
42 score = db.Column(db.Float)
43 engine = db.Column(db.String, primary_key=True)
46class RecommendationLaunchedForProfileEvent(db.Model):
47 """ """
48 __tablename__ = "recommendation_launched_for_profile_event"
50 id = db.Column(db.Integer, primary_key=True, autoincrement=True)
51 occured_at = db.Column(db.DateTime, nullable=False,
52 default=datetime.utcnow)
53 profile_id = db.Column(db.Integer, db.ForeignKey(
54 "profile.profile_id", ondelete="CASCADE"))
56 liked_genres = db.relationship(
57 "RecoLaunchedLikedGenreModel", lazy="subquery")
59 meta = db.relationship(
60 "RecoMetaModel", lazy="subquery")
62 result = db.relationship(
63 "RecoResultModel", lazy="subquery")
65 profile = db.relationship(
66 "ProfileModel", lazy="subquery")