Search in sources :

Example 1 with Meeting

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

the class StandupTimer method storeMeetingStats.

private void storeMeetingStats() {
    if (team != null) {
        long meetingEndTime = System.currentTimeMillis();
        if (individualStatusEndTime == 0) {
            individualStatusEndTime = meetingEndTime;
        }
        try {
            Meeting meeting = new Meeting(team, new Date(meetingStartTime), completedParticipants, (int) ((individualStatusEndTime - individualStatusStartTime) / 1000), (int) ((meetingEndTime - meetingStartTime) / 1000), quickestStatus, longestStatus);
            persistMeeting(meeting);
        } catch (IllegalArgumentException e) {
            Logger.e("Could not store the meeting in the database.  " + e);
        }
    }
}
Also used : Meeting(net.johnpwood.android.standuptimer.model.Meeting) Date(java.util.Date)

Example 2 with Meeting

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

the class MeetingTest method test_delete_a_meeting.

@MediumTest
public void test_delete_a_meeting() {
    Team team = new Team("Test Team");
    Meeting meeting = new Meeting(team, new GregorianCalendar(2010, 1, 5, 10, 15, 0).getTime(), 5, 240, 300, 30, 120);
    meeting = meeting.save(mContext);
    assertEquals(1, Meeting.findAllByTeam(team, mContext).size());
    meeting.delete(mContext);
    assertEquals(0, Meeting.findAllByTeam(team, mContext).size());
}
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 3 with Meeting

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

the class TeamTest method test_deleting_a_team_deletes_its_meetings_as_well.

@MediumTest
public void test_deleting_a_team_deletes_its_meetings_as_well() {
    Team team = Team.create("Test Team", mContext);
    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);
    ;
    assertFalse(Meeting.findAllByTeam(team, mContext).isEmpty());
    team.delete(mContext);
    assertEquals(0, Team.findAllTeamNames(mContext).size());
    assertTrue(Meeting.findAllByTeam(team, mContext).isEmpty());
}
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 4 with Meeting

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

the class MeetingDAOTest method test_delete_a_single_meeting.

@MediumTest
public void test_delete_a_single_meeting() {
    Meeting meeting = new Meeting(new Team("Test Team"), new GregorianCalendar(2010, 1, 5, 10, 15, 0).getTime(), 5, 240, 300, 30, 120);
    meeting = dao.save(meeting);
    meeting = dao.findById(meeting.getId());
    assertNotNull(meeting.getId());
    dao.delete(meeting);
    meeting = dao.findById(meeting.getId());
    assertNull(meeting);
}
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 5 with Meeting

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

the class MeetingDAO method findById.

public Meeting findById(Long id) {
    Cursor cursor = null;
    Meeting meeting = null;
    try {
        SQLiteDatabase db = getReadableDatabase();
        cursor = db.query(MEETINGS_TABLE_NAME, MEETINGS_ALL_COLUMS, _ID + " = ?", new String[] { id.toString() }, null, null, null);
        if (cursor.getCount() == 1) {
            if (cursor.moveToFirst()) {
                meeting = createMeetingFromCursorData(cursor);
            }
        }
    } finally {
        closeCursor(cursor);
    }
    return meeting;
}
Also used : Meeting(net.johnpwood.android.standuptimer.model.Meeting) SQLiteDatabase(android.database.sqlite.SQLiteDatabase) Cursor(android.database.Cursor)

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