@Test public void shouldSyncLastYearStockCards() { syncStockCardsLastYearSilently.performSync().subscribe(new GetOnCompleteSubscriber()); }
public Observable<List<StockCard>> performSync() { final int monthsInAYear = 12; lmisRestApi = LMISApp.getInstance().getRestApi(); facilityId = UserInfoMgr.getInstance().getUser().getFacilityId(); List<Observable<SyncDownStockCardResponse>> tasks = new ArrayList<>(); scheduler = SchedulerBuilder.createScheduler(); int startMonth = sharedPreferenceMgr.getPreference().getInt(SharedPreferenceMgr.KEY_STOCK_SYNC_CURRENT_INDEX, 1); Date now = getActualDate(); for (int month = startMonth; month <= monthsInAYear; month++) { Observable<SyncDownStockCardResponse> objectObservable = createObservableToFetchStockMovements(month, now); tasks.add(objectObservable); } return zipObservables(tasks); }
SyncStockCardsLastYearSilently { public Observable<List<StockCard>> performSync() { final int monthsInAYear = 12; lmisRestApi = LMISApp.getInstance().getRestApi(); facilityId = UserInfoMgr.getInstance().getUser().getFacilityId(); List<Observable<SyncDownStockCardResponse>> tasks = new ArrayList<>(); scheduler = SchedulerBuilder.createScheduler(); int startMonth = sharedPreferenceMgr.getPreference().getInt(SharedPreferenceMgr.KEY_STOCK_SYNC_CURRENT_INDEX, 1); Date now = getActualDate(); for (int month = startMonth; month <= monthsInAYear; month++) { Observable<SyncDownStockCardResponse> objectObservable = createObservableToFetchStockMovements(month, now); tasks.add(objectObservable); } return zipObservables(tasks); } }
SyncStockCardsLastYearSilently { public Observable<List<StockCard>> performSync() { final int monthsInAYear = 12; lmisRestApi = LMISApp.getInstance().getRestApi(); facilityId = UserInfoMgr.getInstance().getUser().getFacilityId(); List<Observable<SyncDownStockCardResponse>> tasks = new ArrayList<>(); scheduler = SchedulerBuilder.createScheduler(); int startMonth = sharedPreferenceMgr.getPreference().getInt(SharedPreferenceMgr.KEY_STOCK_SYNC_CURRENT_INDEX, 1); Date now = getActualDate(); for (int month = startMonth; month <= monthsInAYear; month++) { Observable<SyncDownStockCardResponse> objectObservable = createObservableToFetchStockMovements(month, now); tasks.add(objectObservable); } return zipObservables(tasks); } @Inject  SyncStockCardsLastYearSilently(); }
SyncStockCardsLastYearSilently { public Observable<List<StockCard>> performSync() { final int monthsInAYear = 12; lmisRestApi = LMISApp.getInstance().getRestApi(); facilityId = UserInfoMgr.getInstance().getUser().getFacilityId(); List<Observable<SyncDownStockCardResponse>> tasks = new ArrayList<>(); scheduler = SchedulerBuilder.createScheduler(); int startMonth = sharedPreferenceMgr.getPreference().getInt(SharedPreferenceMgr.KEY_STOCK_SYNC_CURRENT_INDEX, 1); Date now = getActualDate(); for (int month = startMonth; month <= monthsInAYear; month++) { Observable<SyncDownStockCardResponse> objectObservable = createObservableToFetchStockMovements(month, now); tasks.add(objectObservable); } return zipObservables(tasks); } @Inject  SyncStockCardsLastYearSilently(); Observable<List<StockCard>> performSync(); }
SyncStockCardsLastYearSilently { public Observable<List<StockCard>> performSync() { final int monthsInAYear = 12; lmisRestApi = LMISApp.getInstance().getRestApi(); facilityId = UserInfoMgr.getInstance().getUser().getFacilityId(); List<Observable<SyncDownStockCardResponse>> tasks = new ArrayList<>(); scheduler = SchedulerBuilder.createScheduler(); int startMonth = sharedPreferenceMgr.getPreference().getInt(SharedPreferenceMgr.KEY_STOCK_SYNC_CURRENT_INDEX, 1); Date now = getActualDate(); for (int month = startMonth; month <= monthsInAYear; month++) { Observable<SyncDownStockCardResponse> objectObservable = createObservableToFetchStockMovements(month, now); tasks.add(objectObservable); } return zipObservables(tasks); } @Inject  SyncStockCardsLastYearSilently(); Observable<List<StockCard>> performSync();  }