use of org.fossasia.openevent.app.data.models.Attendee in project open-event-orga-app by fossasia.
the class AttendeeCheckInJob method onRunJob.
@NonNull
@Override
// No information on possible exceptions available
@SuppressWarnings("PMD.AvoidCatchingGenericException")
protected Result onRunJob(Params params) {
DaggerAppComponent.create().inject(this);
Timber.d("Running batch job : %s", TAG);
Iterable<Attendee> attendees = attendeeRepository.getPendingCheckIns().blockingIterable();
for (Attendee attendee : attendees) {
Timber.d("Trying to toggle attendee status -> %s", attendee);
try {
Attendee toggled = attendeeRepository.toggleAttendeeCheckStatus(attendee).blockingFirst();
Timber.d("Attendee check in job succeeded for attendee: %s", toggled);
} catch (Exception exception) {
Timber.e("Attendee Check In Job Failed for attendee status -> %ss\n" + "With error: %s\n" + "The job is rescheduled", attendee, exception.getMessage());
return Result.RESCHEDULE;
}
}
return Result.SUCCESS;
}
use of org.fossasia.openevent.app.data.models.Attendee in project open-event-orga-app by fossasia.
the class StickyHeaderAdapter method onBindHeaderViewHolder.
@Override
public void onBindHeaderViewHolder(HeaderViewHolder viewHolder, int position) {
if (sortByName) {
Attendee attendee = (Attendee) getFastAdapter().getItem(position);
viewHolder.bindHeader(attendee.getTicket().getType());
} else
viewHolder.bindHeader(getFastAdapter().getItem(position).getHeader());
}
use of org.fossasia.openevent.app.data.models.Attendee in project open-event-orga-app by fossasia.
the class AttendeePresenterTest method shouldShowEmptyViewOnNoItemAfterSwipeRefresh.
@Test
public void shouldShowEmptyViewOnNoItemAfterSwipeRefresh() {
ArrayList<Attendee> attendees = new ArrayList<>();
when(attendeeRepository.getAttendees(ID, true)).thenReturn(Observable.fromIterable(attendees));
InOrder inOrder = Mockito.inOrder(attendeesView);
attendeesPresenter.loadAttendees(true);
inOrder.verify(attendeesView).showEmptyView(false);
inOrder.verify(attendeesView).showResults(attendees);
inOrder.verify(attendeesView).showEmptyView(true);
}
use of org.fossasia.openevent.app.data.models.Attendee in project open-event-orga-app by fossasia.
the class UtilsTest method shouldFindIndex.
@Test
public void shouldFindIndex() {
List<Attendee> attendees = Arrays.asList(Attendee.builder().id(12).build(), Attendee.builder().id(34).build(), Attendee.builder().id(10).build(), Attendee.builder().id(90).build(), Attendee.builder().id(3).build());
Attendee newAttendee = Attendee.builder().id(10).build();
Utils.PropertyMatcher<Attendee> idEqual = (first, second) -> first.getId() == second.getId();
Utils.indexOf(attendees, newAttendee, idEqual).test().assertNoErrors().assertValue(2);
newAttendee.setId(12);
Utils.indexOf(attendees, newAttendee, idEqual).test().assertNoErrors().assertValue(0);
newAttendee.setId(3);
Utils.indexOf(attendees, newAttendee, idEqual).test().assertNoErrors().assertValue(4);
newAttendee.setId(2);
Utils.indexOf(attendees, newAttendee, idEqual).test().assertNoErrors().assertValue(-1);
}
Aggregations