# Path: kardboard/app.py
#     DEBUG_TOOLBAR = True
#     DEBUG_TOOLBAR = False
#     SENTRY_SUPPORT = True
#     SENTRY_SUPPORT = False
# def get_app():
# 
# Path: kardboard/util.py
# def now():
#     return datetime.datetime.now()
# 
# def delta_in_hours(delta):
#     try:
#         seconds = delta.total_seconds()
#     except AttributeError:
#         # We're in pythont 2.6
#         seconds = delta.seconds
#         days = delta.days
#         seconds = seconds + (days * 24 * 60 * 60)
# 
#     hours = (seconds / 60.0) / 60.0
#     hours = round(hours)
#     return hours


from kardboard.app import app
from kardboard.util import now, delta_in_hours


class BlockerRecord(app.db.EmbeddedDocument):
    """
    Represents a blockage of work for a card.
    """

    reason = app.db.StringField(required=True)
    """The reason why the card was considered blocked."""

    blocked_at = app.db.DateTimeField(required=True)
    """When the card's blockage started."""

    unblocked_at = app.db.DateTimeField(required=False)
    """When the card's blockage stopped."""

    @property
    def duration(self):
        if self.unblocked_at is not None:
            unblocked_at = self.unblocked_at
        else:

# Path: kardboard/app.py
#     DEBUG_TOOLBAR = True
#     DEBUG_TOOLBAR = False
#     SENTRY_SUPPORT = True
#     SENTRY_SUPPORT = False
# def get_app():
# 
# Path: kardboard/util.py
# def now():
#     return datetime.datetime.now()
# 
# def delta_in_hours(delta):
#     try:
#         seconds = delta.total_seconds()
#     except AttributeError:
#         # We're in pythont 2.6
#         seconds = delta.seconds
#         days = delta.days
#         seconds = seconds + (days * 24 * 60 * 60)
# 
#     hours = (seconds / 60.0) / 60.0
#     hours = round(hours)
#     return hours


# Path: kardboard/models/blocker.py
from kardboard.app import app
from kardboard.util import now, delta_in_hours



class BlockerRecord(app.db.EmbeddedDocument):
    """
    Represents a blockage of work for a card.
    """

    reason = app.db.StringField(required=True)
    """The reason why the card was considered blocked."""

    blocked_at = app.db.DateTimeField(required=True)
    """When the card's blockage started."""

    unblocked_at = app.db.DateTimeField(required=False)
    """When the card's blockage stopped."""

    @property
    def duration(self):
        if self.unblocked_at is not None:
            unblocked_at = self.unblocked_at
        else:

            unblocked_at = now()