Search in sources :

Example 6 with Event

use of org.fossasia.openevent.app.data.models.Event in project open-event-orga-app by fossasia.

the class DateServiceTest method testClashUpcoming.

@Test
public void testClashUpcoming() {
    Event upcomingEarliest = new Event();
    String max = DateUtils.formatDateToIso(LocalDateTime.MAX);
    String maxMinus5 = DateUtils.formatDateToIso(LocalDateTime.MAX.minusDays(5));
    upcomingEarliest.setStartsAt(new ObservableString(maxMinus5));
    upcomingEarliest.setEndsAt(new ObservableString(max));
    assertEquals(1, DateService.compareEventDates(UPCOMING, upcomingEarliest));
}
Also used : ObservableString(org.fossasia.openevent.app.data.models.dto.ObservableString) Event(org.fossasia.openevent.app.data.models.Event) ObservableString(org.fossasia.openevent.app.data.models.dto.ObservableString) Test(org.junit.Test)

Example 7 with Event

use of org.fossasia.openevent.app.data.models.Event in project open-event-orga-app by fossasia.

the class TicketTest method setUp.

@Override
public void setUp() {
    RxJavaPlugins.setIoSchedulerHandler(scheduler -> Schedulers.trampoline());
    RxAndroidPlugins.setInitMainThreadSchedulerHandler(schedulerCallable -> Schedulers.trampoline());
    Event event = new Event();
    event.setId(Long.valueOf(12));
    Ticket ticket1 = Ticket.builder().id(1L).quantity(120L).type(FREE).event(event).build();
    Ticket ticket2 = Ticket.builder().id(2L).quantity(20L).type(PAID).price(25.99f).event(event).build();
    Ticket ticket3 = Ticket.builder().id(3L).quantity(30L).type(DONATION).event(event).build();
    Ticket ticket4 = Ticket.builder().id(4L).quantity(10L).type(DONATION).event(event).build();
    Ticket ticket5 = Ticket.builder().id(5L).quantity(50L).type(PAID).price(99.99f).event(event).build();
    Attendee attendee = Attendee.builder().id(1L).ticket(ticket1).event(event).build();
    Attendee attendee2 = Attendee.builder().id(2L).ticket(ticket1).event(event).build();
    Attendee attendee3 = Attendee.builder().id(3L).ticket(ticket1).event(event).build();
    Attendee attendee4 = Attendee.builder().id(4L).ticket(ticket2).event(event).build();
    Attendee attendee5 = Attendee.builder().id(5L).ticket(ticket2).event(event).build();
    Attendee attendee6 = Attendee.builder().id(6L).ticket(ticket4).event(event).build();
    Attendee attendee7 = Attendee.builder().id(7L).ticket(ticket5).event(event).build();
    event.setTickets(Arrays.asList(ticket1, ticket2, ticket3, ticket4, ticket5));
    DatabaseRepository databaseRepository = new DatabaseRepository();
    databaseRepository.save(Event.class, event).subscribe();
    databaseRepository.saveList(Attendee.class, Arrays.asList(attendee, attendee2, attendee3, attendee4, attendee5, attendee6, attendee7)).subscribe();
    ticketRepository = new TicketRepository(null, databaseRepository, null);
}
Also used : Ticket(org.fossasia.openevent.app.data.models.Ticket) TicketRepository(org.fossasia.openevent.app.data.repository.TicketRepository) DatabaseRepository(org.fossasia.openevent.app.data.db.DatabaseRepository) Event(org.fossasia.openevent.app.data.models.Event) Attendee(org.fossasia.openevent.app.data.models.Attendee)

Example 8 with Event

use of org.fossasia.openevent.app.data.models.Event in project open-event-orga-app by fossasia.

the class EventsListAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(final EventRecyclerViewHolder holder, int position) {
    final Event thisEvent = events.get(position);
    holder.bind(thisEvent);
}
Also used : Event(org.fossasia.openevent.app.data.models.Event)

Example 9 with Event

use of org.fossasia.openevent.app.data.models.Event in project open-event-orga-app by fossasia.

the class CreateEventFragment method onActivityResult.

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == PLACE_PICKER_REQUEST && resultCode == RESULT_OK) {
        // once place is picked from map, make location fields visible for confirmation by user
        showLocationLayouts();
        // set event attributes
        Place place = PlacePicker.getPlace(getActivity(), data);
        Event event = binding.getEvent();
        event.latitude = place.getLatLng().latitude;
        event.longitude = place.getLatLng().longitude;
        // auto-complete location fields for confirmation by user
        binding.form.locationName.setText(place.getAddress());
        binding.form.searchableLocationName.setText(getPresenter().getSearchableLocationName(place.getAddress().toString()));
    }
}
Also used : Event(org.fossasia.openevent.app.data.models.Event) Place(com.google.android.gms.location.places.Place)

Example 10 with Event

use of org.fossasia.openevent.app.data.models.Event in project open-event-orga-app by fossasia.

the class MainPresenter method showLoadedEvent.

private void showLoadedEvent(long storedEventId) {
    getView().setEventId(storedEventId);
    Event staticEvent = ContextManager.getSelectedEvent();
    if (staticEvent != null) {
        getView().showResult(staticEvent);
        if (!isRotated())
            showEvent(staticEvent);
        return;
    }
    eventRepository.getEvent(storedEventId, false).compose(dispose(getDisposable())).compose(erroneous(getView())).subscribe(bus::pushSelectedEvent, Logger::logError);
}
Also used : Event(org.fossasia.openevent.app.data.models.Event) Logger(org.fossasia.openevent.app.common.rx.Logger)

Aggregations

Event (org.fossasia.openevent.app.data.models.Event)24 Test (org.junit.Test)19 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)6 ObservableString (org.fossasia.openevent.app.data.models.dto.ObservableString)4 InOrder (org.mockito.InOrder)3 Completable (io.reactivex.Completable)2 TestObserver (io.reactivex.observers.TestObserver)2 Place (com.google.android.gms.location.places.Place)1 ArrayList (java.util.ArrayList)1 Logger (org.fossasia.openevent.app.common.rx.Logger)1 DatabaseRepository (org.fossasia.openevent.app.data.db.DatabaseRepository)1 Attendee (org.fossasia.openevent.app.data.models.Attendee)1 Ticket (org.fossasia.openevent.app.data.models.Ticket)1 TicketRepository (org.fossasia.openevent.app.data.repository.TicketRepository)1