Exemple #1
0
class Assignment(db.Model):
    __tablename__ = 'assignment'
    ID = db.Column(db.Integer, primary_key=True)
    assignmentUID = db.Column(db.Text, unique=True)
    countEvent_ID = db.Column(db.Integer, db.ForeignKey('count_event.ID'))
    location_ID = db.Column(db.Integer, db.ForeignKey('location.ID'))
    user_ID = db.Column(db.Integer, db.ForeignKey('user.ID'))
    invitationSent = db.Column(db.Text, default="")

    #countevent = relationship(CountEvent)
    #locations = relationship(Location)
    #user = relationship(User)

    # Get the Starting date of the related event
    eventStartDate = deferred(
        select([CountEvent.startDate]).where(CountEvent.ID == countEvent_ID))
    organization_ID = deferred(
        select([CountEvent.organization_ID
                ]).where(CountEvent.ID == countEvent_ID))
    locationName = deferred(
        select([Location.locationName]).where(Location.ID == location_ID))
    userName = deferred(select([User.name]).where(User.ID == user_ID))

    def __init__(self, eventID, UID):
        self.countEvent_ID = eventID
        self.assignmentUID = UID

    def __repr__(self):
        return '<UID: %r>' % self.assignmentUID
Exemple #2
0
class UserOrganization(db.Model):
    ID = db.Column(db.Integer, primary_key=True)
    user_ID = db.Column(db.Integer, db.ForeignKey('user.ID'), nullable=False)
    organization_ID = db.Column(db.Integer,
                                db.ForeignKey('organization.ID'),
                                nullable=False)

    def __init__(self, user_ID, organization_ID):
        self.user_ID = user_ID
        self.organization_ID = organization_ID
Exemple #3
0
class TravelerFeature(db.Model):
    ID = db.Column(db.Integer, primary_key=True)
    traveler_ID = db.Column(db.Integer, db.ForeignKey('traveler.ID'))
    feature_ID = db.Column(db.Integer, db.ForeignKey('feature.ID'))

    def __init__(self, traveler, feature):
        self.traveler_ID = traveler
        self.feature_ID = feature

    def __repr__(self):
        return '<TravFeat: %r / %r>' % (self.traveler_ID, self.feature_ID)
Exemple #4
0
class EventTraveler(db.Model):
    ID = db.Column(db.Integer, primary_key=True)
    sortOrder = db.Column(db.Integer, default=0)
    countEvent_ID = db.Column(db.Integer, db.ForeignKey('count_event.ID'))
    traveler_ID = db.Column(db.Integer, db.ForeignKey('traveler.ID'))

    travelerName = deferred(
        select([Traveler.name]).where(Traveler.ID == traveler_ID))

    def __init__(self, event, traveler):
        self.countEvent_ID = event
        self.traveler_ID = traveler

    def __repr__(self):
        return '<EventTrav: %r : %r>' % (self.countEvent_ID, self.traveler_ID)
Exemple #5
0
class Trip(db.Model):
    ID = db.Column(db.Integer, primary_key=True)
    tripCount = db.Column(db.Integer)
    tripDate = db.Column(db.Text)
    turnDirection = db.Column(db.Text)
    seqNo = db.Column(db.Text)
    location_ID = db.Column(db.Integer, db.ForeignKey('location.ID'))
    traveler_ID = db.Column(db.Integer, db.ForeignKey('traveler.ID'))
    countEvent_ID = db.Column(db.Integer, db.ForeignKey('count_event.ID'))

    countevent = relationship(CountEvent)
    location = relationship(Location)
    traveler = relationship(Traveler)

    #from views.utils import getDatetimeFromString

    # Get the Starting date of the related event
    eventStartDate = deferred(
        select([CountEvent.startDate]).where(CountEvent.ID == countEvent_ID))
    travelerName = deferred(
        select([Traveler.name]).where(Traveler.ID == traveler_ID))
    locationName = deferred(
        select([Location.locationName]).where(Location.ID == location_ID))
    locationLatitude = deferred(
        select([Location.latitude]).where(Location.ID == location_ID))
    locationLongitude = deferred(
        select([Location.longitude]).where(Location.ID == location_ID))

    def __init__(self, tripCnt, tripDate, turnDirection, seqNo, location_ID,
                 traveler_ID, countEvent_ID):
        self.tripCount = tripCnt
        self.tripDate = tripDate
        self.turnDirection = turnDirection
        self.seqNo = seqNo
        self.location_ID = location_ID
        self.traveler_ID = traveler_ID
        self.countEvent_ID = countEvent_ID

    def __repr__(self):
        return '<Date: %r>' % self.tripDate
Exemple #6
0
class Location(db.Model):
    ID = db.Column(db.Integer, primary_key=True)
    locationName = db.Column(db.Text, nullable=False)
    NS_Street = db.Column(db.Text)
    NS_Heading = db.Column(db.Float, nullable=False, default=0)
    EW_Street = db.Column(db.Text)
    EW_Heading = db.Column(db.Float, nullable=False, default=0)
    locationType = db.Column(db.Text)
    city = db.Column(db.Text)
    state = db.Column(db.Text)
    latitude = db.Column(db.Text)
    longitude = db.Column(db.Text)
    organization_ID = db.Column(db.Integer,
                                db.ForeignKey('organization.ID'),
                                nullable=False)

    def __init__(self, name, org):
        self.locationName = name
        self.organization_ID = org

    def __repr__(self):
        return self.locationName
Exemple #7
0
class CountEvent(db.Model):
    #__tablename__ = 'countEvent'
    ID = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.Text)
    weather = db.Column(db.Text)
    startDate = db.Column(db.Text, nullable=False)
    endDate = db.Column(db.Text, nullable=False)
    timeZone = db.Column(db.Text)
    isDST = db.Column(db.Integer, default=0)
    organization_ID = db.Column(db.Integer,
                                db.ForeignKey('organization.ID'),
                                nullable=False)

    def __init__(self, title, start, end, timeZone, isDST, org):
        self.title = title
        self.startDate = start
        self.endDate = end
        self.timeZone = timeZone
        self.isDST = isDST
        self.organization_ID = org

    def __repr__(self):
        return '<Start: %r, End: %r>' % (self.startDate, self.endDate)