예제 #1
0
    def test_startdate(self):
        """Test the startdate helper function."""
        req = create_request(query_string={'dates': '7d'})
        eq_(startdate(req), date.today() - timedelta(days=7))

        req = create_request(query_string={'dates': 'today'})
        eq_(startdate(req), date.today())

        req = create_request(query_string={'day': '2012-05-24'})
        eq_(startdate(req), datetime(2012, 5, 24))

        req = create_request(query_string={'day': 'today'})
        eq_(startdate(req), None)

        req = create_request()
        eq_(startdate(req), None)
예제 #2
0
    def test_startdate(self):
        """Test the startdate helper function."""
        req = create_request(query_string={'dates': '7d'})
        eq_(startdate(req), date.today() - timedelta(days=7))

        req = create_request(query_string={'dates': 'today'})
        eq_(startdate(req), date.today())

        req = create_request(query_string={'day': '2012-05-24'})
        eq_(startdate(req), datetime(2012, 5, 24))

        req = create_request(query_string={'day': 'today'})
        eq_(startdate(req), None)

        req = create_request()
        eq_(startdate(req), None)
예제 #3
0
파일: views.py 프로젝트: strogo/standup
def index():
    """The home page."""
    return render_template(
        'index.html',
        statuses=paginate(
            Status.query.filter(Status.reply_to==None).order_by(
                db.desc(Status.created)),
            request.args.get('page', 1),
            startdate(request),
            enddate(request)),)
예제 #4
0
def index():
    """The home page."""
    db = get_session(current_app)

    return render_template(
        'status/index.html',
        statuses=paginate(
            db.query(Status).filter_by(reply_to=None).order_by(
                desc(Status.created)), request.args.get('page', 1),
            startdate(request), enddate(request)),
    )
예제 #5
0
파일: views.py 프로젝트: Ms2ger/standup
def index():
    """The home page."""
    db = get_session(current_app)

    return render_template(
        'status/index.html',
        statuses=paginate(
            db.query(Status).filter_by(reply_to=None).order_by(
                desc(Status.created)),
            request.args.get('page', 1),
            startdate(request),
            enddate(request)),)
예제 #6
0
def user(slug):
    """The user page. Shows a user's statuses."""
    db = get_session(current_app)

    user = db.query(User).filter_by(slug=slug).first()
    if not user:
        return page_not_found('User not found.')
    return render_template('status/user.html',
                           user=user,
                           statuses=user.recent_statuses(
                               request.args.get('page', 1), startdate(request),
                               enddate(request)))
예제 #7
0
파일: views.py 프로젝트: strogo/standup
def user(slug):
    """The user page. Shows a user's statuses."""
    user = User.query.filter_by(slug=slug).first()
    if not user:
        return page_not_found('User not found.')
    return render_template(
        'user.html',
        user=user,
        statuses=user.recent_statuses(
            request.args.get('page', 1),
            startdate(request),
            enddate(request)))
예제 #8
0
def team(slug):
    """The team page. Shows statuses for all users in the team."""
    db = get_session(current_app)

    team = db.query(Team).filter_by(slug=slug).first()
    if not team:
        return page_not_found('Team not found.')

    return render_template('status/team.html',
                           team=team,
                           users=team.users,
                           teams=db.query(Team).order_by(Team.name).all(),
                           statuses=team.recent_statuses(
                               request.args.get('page', 1), startdate(request),
                               enddate(request)))
예제 #9
0
def project(slug):
    """The project page. Shows a project's statuses."""
    db = get_session(current_app)

    project = db.query(Project).filter_by(slug=slug).first()
    if not project:
        return page_not_found('Project not found.')

    return render_template('status/project.html',
                           project=project,
                           projects=db.query(Project).order_by(
                               Project.name).filter(Project.statuses.any()),
                           statuses=project.recent_statuses(
                               request.args.get('page', 1), startdate(request),
                               enddate(request)))
예제 #10
0
파일: views.py 프로젝트: strogo/standup
def team(slug):
    """The team page. Shows a statuses for all users in the team."""
    team = Team.query.filter_by(slug=slug).first()
    if not team:
        return page_not_found('Team not found.')

    return render_template(
        'team.html',
        team=team,
        users=team.users,
        teams=Team.query.order_by(Team.name).all(),
        statuses=team.recent_statuses(
            request.args.get('page', 1),
            startdate(request),
            enddate(request)))
예제 #11
0
파일: views.py 프로젝트: strogo/standup
def project(slug):
    """The project page. Shows a project's statuses."""
    project = Project.query.filter_by(slug=slug).first()
    if not project:
        return page_not_found('Project not found.')

    return render_template(
        'project.html',
        project=project,
        projects=Project.query.order_by(Project.name).filter(
            Project.statuses.any()),
        statuses=project.recent_statuses(
            request.args.get('page', 1),
            startdate(request),
            enddate(request)))
예제 #12
0
def weekly():
    """The weekly status page."""
    db = get_session(current_app)

    #select id, user_id, created, strftime('%Y%W', created), date(created, 'weekday 1'), content from status order by 4, 2, 3;
    return render_template(
        'status/weekly.html',
        week=request.args.get('week', None),
        statuses=paginate(db.query(Status).filter_by(reply_to=None).order_by(
            desc(WeekColumnClause("created")), Status.user_id,
            desc(Status.created)),
                          request.args.get('page', 1),
                          startdate(request),
                          enddate(request),
                          per_page=100),
    )
예제 #13
0
파일: views.py 프로젝트: Ms2ger/standup
def weekly():
    """The weekly status page."""
    db = get_session(current_app)

    #select id, user_id, created, strftime('%Y%W', created), date(created, 'weekday 1'), content from status order by 4, 2, 3;
    return render_template(
        'status/weekly.html',
        week=request.args.get('week', None),
        statuses=paginate(
            db.query(Status).filter_by(reply_to=None).order_by(
                desc(WeekColumnClause("created")),
                Status.user_id,
                desc(Status.created)),
            request.args.get('page', 1),
            startdate(request),
            enddate(request),
            per_page=100),)