use of com.eventyay.organizer.data.ticket.Ticket in project open-event-orga-app by fossasia.
the class CreateTicketViewModel method createTicket.
public void createTicket() {
if (!verify())
return;
long eventId = ContextManager.getSelectedEvent().getId();
Event event = new Event();
event.setId(eventId);
ticket.setEvent(event);
compositeDisposable.add(ticketRepository.createTicket(ticket).doOnSubscribe(disposable -> progress.setValue(true)).doFinally(() -> progress.setValue(false)).subscribe(createdTicket -> {
success.setValue("Ticket Created");
dismiss.call();
}, throwable -> error.setValue(ErrorUtils.getMessage(throwable).toString())));
}
use of com.eventyay.organizer.data.ticket.Ticket in project open-event-orga-app by fossasia.
the class AutoCheckInFragment method autoCheckInAll.
// Inevitable DD anomaly
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
private void autoCheckInAll() {
if (autoCheckInViewModel.getTickets() == null) {
return;
}
boolean autoCheckInAll = true;
for (Ticket ticket : autoCheckInViewModel.getTickets().getValue()) {
if (!ticket.autoCheckinEnabled) {
autoCheckInAll = false;
break;
}
}
binding.autoCheckInAllCheckbox.setChecked(autoCheckInAll);
}
use of com.eventyay.organizer.data.ticket.Ticket in project open-event-orga-app by fossasia.
the class TicketRepositoryTest method shouldSaveCreatedTicket.
@Test
public void shouldSaveCreatedTicket() {
Ticket created = mock(Ticket.class);
when(repository.isConnected()).thenReturn(true);
when(ticketApi.postTicket(TICKET)).thenReturn(Observable.just(created));
when(repository.save(eq(Ticket.class), eq(created))).thenReturn(Completable.complete());
ticketRepository.createTicket(TICKET).subscribe();
verify(repository).save(Ticket.class, created);
}
use of com.eventyay.organizer.data.ticket.Ticket in project open-event-orga-app by fossasia.
the class CheckInRestrictions method checkRestrictAll.
// Inevitable DD anomaly
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
private void checkRestrictAll() {
if (ticketSettingsViewModel.getTickets() == null) {
return;
}
boolean restrictAll = true;
for (Ticket ticket : ticketSettingsViewModel.getTickets().getValue()) {
if (!ticket.isCheckinRestricted) {
restrictAll = false;
break;
}
}
binding.restrictAllCheckbox.setChecked(restrictAll);
}
use of com.eventyay.organizer.data.ticket.Ticket in project open-event-orga-app by fossasia.
the class EventRepositoryImpl method saveEvent.
private void saveEvent(Event event) {
event.setComplete(true);
repository.save(Event.class, event).subscribe();
List<Ticket> tickets = event.getTickets();
if (tickets != null) {
for (Ticket ticket : tickets) ticket.setEvent(event);
repository.saveList(Ticket.class, tickets).subscribe();
}
}
Aggregations