use of net.johnpwood.android.standuptimer.model.Meeting in project standup-timer by jwood.
the class MeetingDAO method findByTeamAndDate.
public Meeting findByTeamAndDate(Team team, Date date) {
Cursor cursor = null;
Meeting meeting = null;
try {
long startTime = date.getTime();
Date endDate = new Date(date.getTime());
endDate.setSeconds(endDate.getSeconds() + 1);
long endTime = endDate.getTime();
SQLiteDatabase db = getReadableDatabase();
cursor = db.query(MEETINGS_TABLE_NAME, MEETINGS_ALL_COLUMS, MEETINGS_TEAM_NAME + " = ? and " + MEETINGS_MEETING_TIME + " >= ? and " + MEETINGS_MEETING_TIME + " < ?", new String[] { team.getName(), Long.toString(startTime), Long.toString(endTime) }, null, null, null);
if (cursor.getCount() == 1) {
if (cursor.moveToFirst()) {
meeting = createMeetingFromCursorData(cursor);
}
}
} finally {
closeCursor(cursor);
}
return meeting;
}
use of net.johnpwood.android.standuptimer.model.Meeting in project standup-timer by jwood.
the class TeamDetails method createMeetingListAdapter.
private ArrayAdapter<String> createMeetingListAdapter() {
List<String> meetingDescriptions = new ArrayList<String>();
if (team != null) {
List<Meeting> meetings = team.findAllMeetings(TeamDetails.this);
for (Meeting meeting : meetings) {
meetingDescriptions.add(meeting.getDescription());
}
}
ArrayAdapter<String> adapter = new ArrayAdapter<String>(TeamDetails.this, android.R.layout.simple_list_item_1, meetingDescriptions);
return adapter;
}
use of net.johnpwood.android.standuptimer.model.Meeting in project standup-timer by jwood.
the class MeetingDAOTest method test_delete_all_by_team.
@MediumTest
public void test_delete_all_by_team() {
Team team = new Team("Test Team");
dao.save(new Meeting(team, new GregorianCalendar(2010, 1, 5, 10, 15, 0).getTime(), 5, 240, 300, 30, 120));
dao.save(new Meeting(team, new GregorianCalendar(2010, 1, 4, 10, 15, 0).getTime(), 5, 240, 300, 30, 120));
assertFalse(dao.findAllByTeam(team).isEmpty());
dao.deleteAllByTeam(team);
assertTrue(dao.findAllByTeam(team).isEmpty());
}
use of net.johnpwood.android.standuptimer.model.Meeting in project standup-timer by jwood.
the class MeetingDAOTest method test_find_all_meetings_by_team_in_cronological_order.
@MediumTest
public void test_find_all_meetings_by_team_in_cronological_order() {
Team team = new Team("Test Team");
dao.save(new Meeting(team, new GregorianCalendar(2010, 1, 5, 10, 15, 0).getTime(), 5, 240, 300, 30, 120));
dao.save(new Meeting(team, new GregorianCalendar(2010, 1, 4, 10, 15, 0).getTime(), 5, 240, 300, 30, 120));
dao.save(new Meeting(team, new GregorianCalendar(2010, 1, 7, 10, 15, 0).getTime(), 5, 240, 300, 30, 120));
dao.save(new Meeting(team, new GregorianCalendar(2010, 1, 1, 10, 15, 0).getTime(), 5, 240, 300, 30, 120));
dao.save(new Meeting(team, new GregorianCalendar(2010, 1, 2, 10, 15, 0).getTime(), 5, 240, 300, 30, 120));
List<Meeting> meetings = dao.findAllByTeam(team);
assertEquals(5, meetings.size());
assertEquals(new GregorianCalendar(2010, 1, 7, 10, 15, 0).getTime(), meetings.get(0).getDateTime());
assertEquals(new GregorianCalendar(2010, 1, 5, 10, 15, 0).getTime(), meetings.get(1).getDateTime());
assertEquals(new GregorianCalendar(2010, 1, 4, 10, 15, 0).getTime(), meetings.get(2).getDateTime());
assertEquals(new GregorianCalendar(2010, 1, 2, 10, 15, 0).getTime(), meetings.get(3).getDateTime());
assertEquals(new GregorianCalendar(2010, 1, 1, 10, 15, 0).getTime(), meetings.get(4).getDateTime());
}
use of net.johnpwood.android.standuptimer.model.Meeting in project standup-timer by jwood.
the class MeetingTest method test_find_all_meetings_by_team.
@MediumTest
public void test_find_all_meetings_by_team() {
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);
;
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);
;
List<Meeting> meetings = Meeting.findAllByTeam(team, mContext);
assertEquals(5, meetings.size());
assertEquals(new GregorianCalendar(2010, 1, 7, 10, 15, 0).getTime(), meetings.get(0).getDateTime());
assertEquals(new GregorianCalendar(2010, 1, 5, 10, 15, 0).getTime(), meetings.get(1).getDateTime());
assertEquals(new GregorianCalendar(2010, 1, 4, 10, 15, 0).getTime(), meetings.get(2).getDateTime());
assertEquals(new GregorianCalendar(2010, 1, 2, 10, 15, 0).getTime(), meetings.get(3).getDateTime());
assertEquals(new GregorianCalendar(2010, 1, 1, 10, 15, 0).getTime(), meetings.get(4).getDateTime());
}
Aggregations