use of ch.hsr.sa.radiotour.dataaccess.models.JudgmentRiderConnection in project app by TourLive.
the class JudgmentRiderConnectionInstrumentedTest method addRewardRiderConnection.
@Test
public void addRewardRiderConnection() {
addRider();
addJudgment();
RealmList<Rider> riderList = new RealmList<>();
RealmList<Judgement> judgementList = new RealmList<>();
riderList.add(RiderPresenter.getInstance().getRiderByStartNr(15));
judgementList.add(JudgmentPresenter.getInstance().getJudgmentsById(93).first());
JudgmentRiderConnection judgmentRiderConnection = new JudgmentRiderConnection();
judgmentRiderConnection.setRank(1);
judgmentRiderConnection.setJudgements(judgementList);
judgmentRiderConnection.setRider(riderList);
synchronized (this) {
judgmentRiderConnectionRepository.addJudgmentRiderConnection(judgmentRiderConnection, onSaveJudgmentRiderConnectionCallback);
}
Assert.assertEquals(1, realm.where(JudgmentRiderConnection.class).findAll().first().getRank());
}
use of ch.hsr.sa.radiotour.dataaccess.models.JudgmentRiderConnection in project app by TourLive.
the class JudgmentRiderConnectionInstrumentedTest method clearAllRewardRiderConnections.
@Test
public void clearAllRewardRiderConnections() {
addRider();
addJudgment();
RealmList<Rider> riderList = new RealmList<>();
RealmList<Judgement> judgementList = new RealmList<>();
riderList.add(RiderPresenter.getInstance().getRiderByStartNr(15));
judgementList.add(JudgmentPresenter.getInstance().getJudgmentsById(93).first());
JudgmentRiderConnection judgmentRiderConnection = new JudgmentRiderConnection();
judgmentRiderConnection.setRank(1);
judgmentRiderConnection.setJudgements(judgementList);
judgmentRiderConnection.setRider(riderList);
synchronized (this) {
judgmentRiderConnectionRepository.addJudgmentRiderConnection(judgmentRiderConnection, onSaveJudgmentRiderConnectionCallback);
}
synchronized (this) {
judgmentRiderConnectionRepository.clearAllJudgmentRiderConnections();
}
Assert.assertEquals(0, realm.where(JudgmentRiderConnection.class).findAll().size());
}
use of ch.hsr.sa.radiotour.dataaccess.models.JudgmentRiderConnection in project app by TourLive.
the class JudgementAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(JudgementViewHolder holder, int position) {
holder.itemTitleJudgement.setText(String.valueOf(judgements.get(position).getName()));
holder.itemJudgementKM.setText("KM " + judgements.get(position).getDistance());
LinearLayoutManager layoutManager = new LinearLayoutManager(context);
RealmList<JudgmentRiderConnection> judgmentRiderConnections = JudgmentRiderConnectionPresenter.getInstance().getJudgmentRiderConnectionsReturnedByJudgment(judgements.get(position));
JudgmentRiderAdapter adapter = new JudgmentRiderAdapter(RewardPresenter.getInstance().getRewardReturnedByJudgment(judgements.get(position)), judgmentRiderConnections, context);
holder.rvJudgmentRiders.setLayoutManager(layoutManager);
holder.rvJudgmentRiders.setAdapter(adapter);
}
Aggregations