Search in sources :

Example 16 with Meeting

use of net.johnpwood.android.standuptimer.model.Meeting in project standup-timer by jwood.

the class MeetingTest method test_find_by_team_and_date.

@MediumTest
public void test_find_by_team_and_date() {
    Team team = new Team("Test Team");
    new Meeting(team, new GregorianCalendar(2010, 1, 5, 10, 15, 0).getTime(), 5, 240, 300, 30, 120).save(mContext);
    new Meeting(team, new GregorianCalendar(2010, 1, 4, 10, 15, 0).getTime(), 5, 240, 300, 30, 120).save(mContext);
    ;
    Meeting expected = new Meeting(team, new GregorianCalendar(2010, 1, 7, 10, 15, 0).getTime(), 5, 240, 300, 30, 120).save(mContext);
    ;
    new Meeting(team, new GregorianCalendar(2010, 1, 1, 10, 15, 0).getTime(), 5, 240, 300, 30, 120).save(mContext);
    ;
    new Meeting(team, new GregorianCalendar(2010, 1, 2, 10, 15, 0).getTime(), 5, 240, 300, 30, 120).save(mContext);
    ;
    Meeting actual = Meeting.findByTeamAndDate(team, new GregorianCalendar(2010, 1, 7, 10, 15, 0).getTime(), mContext);
    assertEquals(expected.getId(), actual.getId());
}
Also used : Meeting(net.johnpwood.android.standuptimer.model.Meeting) GregorianCalendar(java.util.GregorianCalendar) Team(net.johnpwood.android.standuptimer.model.Team) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 17 with Meeting

use of net.johnpwood.android.standuptimer.model.Meeting in project standup-timer by jwood.

the class TeamTest method test_get_average_meeting_stats.

@MediumTest
public void test_get_average_meeting_stats() {
    Team team = Team.create("Test Team", mContext);
    Date dateTime = new GregorianCalendar(2010, 1, 5, 10, 15, 0).getTime();
    new Meeting(team, dateTime, 5, 301, 343, 30, 65).save(mContext);
    new Meeting(team, dateTime, 8, 534, 550, 32, 120).save(mContext);
    new Meeting(team, dateTime, 2, 234, 300, 23, 122).save(mContext);
    new Meeting(team, dateTime, 3, 765, 765, 15, 78).save(mContext);
    new Meeting(team, dateTime, 9, 444, 445, 10, 93).save(mContext);
    MeetingStats averageStats = team.getAverageMeetingStats(mContext);
    assertEquals(5.4f, averageStats.getNumParticipants());
    assertEquals(455.6f, averageStats.getIndividualStatusLength());
    assertEquals(480.6f, averageStats.getMeetingLength());
    assertEquals(22f, averageStats.getQuickestStatus());
    assertEquals(95.6f, averageStats.getLongestStatus());
}
Also used : Meeting(net.johnpwood.android.standuptimer.model.Meeting) GregorianCalendar(java.util.GregorianCalendar) Team(net.johnpwood.android.standuptimer.model.Team) MeetingStats(net.johnpwood.android.standuptimer.model.MeetingStats) Date(java.util.Date) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 18 with Meeting

use of net.johnpwood.android.standuptimer.model.Meeting in project standup-timer by jwood.

the class TeamTest method test_has_meetings.

@MediumTest
public void test_has_meetings() {
    Team team = Team.create("Test Team No Meetings", mContext);
    assertFalse(team.hasMeetings(mContext));
    new Meeting(team, new GregorianCalendar(2010, 1, 5, 10, 15, 0).getTime(), 5, 301, 343, 30, 65).save(mContext);
    assertTrue(team.hasMeetings(mContext));
}
Also used : Meeting(net.johnpwood.android.standuptimer.model.Meeting) GregorianCalendar(java.util.GregorianCalendar) Team(net.johnpwood.android.standuptimer.model.Team) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 19 with Meeting

use of net.johnpwood.android.standuptimer.model.Meeting in project standup-timer by jwood.

the class MeetingDAO method findAllByTeam.

public List<Meeting> findAllByTeam(Team team) {
    List<Meeting> meetings = new ArrayList<Meeting>();
    Cursor cursor = null;
    try {
        SQLiteDatabase db = getReadableDatabase();
        cursor = db.query(MEETINGS_TABLE_NAME, MEETINGS_ALL_COLUMS, MEETINGS_TEAM_NAME + " = ?", new String[] { team.getName() }, null, null, MEETINGS_MEETING_TIME);
        while (cursor.moveToNext()) {
            meetings.add(createMeetingFromCursorData(cursor));
        }
    } finally {
        closeCursor(cursor);
    }
    Logger.d("Found " + meetings.size() + " meetings");
    Collections.reverse(meetings);
    return meetings;
}
Also used : Meeting(net.johnpwood.android.standuptimer.model.Meeting) SQLiteDatabase(android.database.sqlite.SQLiteDatabase) ArrayList(java.util.ArrayList) Cursor(android.database.Cursor)

Example 20 with Meeting

use of net.johnpwood.android.standuptimer.model.Meeting in project standup-timer by jwood.

the class MeetingDAO method createNewMeeting.

private Meeting createNewMeeting(SQLiteDatabase db, Meeting meeting) {
    Logger.d("Creating new meeting for " + meeting.getTeam().getName() + " with a date/time of '" + meeting.getDateTime() + "'");
    ContentValues values = createContentValues(meeting);
    long id = db.insertOrThrow(MEETINGS_TABLE_NAME, null, values);
    return new Meeting(id, meeting);
}
Also used : ContentValues(android.content.ContentValues) Meeting(net.johnpwood.android.standuptimer.model.Meeting)

Aggregations

Meeting (net.johnpwood.android.standuptimer.model.Meeting)24 Team (net.johnpwood.android.standuptimer.model.Team)17 GregorianCalendar (java.util.GregorianCalendar)16 MediumTest (android.test.suitebuilder.annotation.MediumTest)14 Date (java.util.Date)5 Cursor (android.database.Cursor)3 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)3 Context (android.content.Context)2 RenamingDelegatingContext (android.test.RenamingDelegatingContext)2 ArrayList (java.util.ArrayList)2 MeetingDAO (net.johnpwood.android.standuptimer.dao.MeetingDAO)2 TeamDAO (net.johnpwood.android.standuptimer.dao.TeamDAO)2 ContentValues (android.content.ContentValues)1 ArrayAdapter (android.widget.ArrayAdapter)1 ParseException (java.text.ParseException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 CannotUpdateMeetingException (net.johnpwood.android.standuptimer.dao.CannotUpdateMeetingException)1 MeetingStats (net.johnpwood.android.standuptimer.model.MeetingStats)1