use of org.olat.modules.qpool.QuestionStatus in project openolat by klemens.
the class QItemQueriesDAOTest method shouldGetItemsFilteredByQuestionStatus.
@Test
public void shouldGetItemsFilteredByQuestionStatus() {
QuestionStatus status = QuestionStatus.revised;
QuestionItemImpl item11 = createRandomItem(createRandomIdentity());
item11.setQuestionStatus(status);
QuestionItemImpl item12 = createRandomItem(createRandomIdentity());
item12.setQuestionStatus(status);
QuestionItem item21 = createRandomItem(createRandomIdentity());
QuestionItem item22 = createRandomItem(createRandomIdentity());
QuestionItem item23 = createRandomItem(createRandomIdentity());
dbInstance.commitAndCloseSession();
SearchQuestionItemParams params = new SearchQuestionItemParams(createRandomIdentity(), null);
params.setQuestionStatus(status);
List<QuestionItemView> loadedItems = qItemQueriesDao.getItems(params, null, 0, -1);
assertThat(loadedItems).hasSize(2);
assertThat(keysOf(loadedItems)).containsOnlyElementsOf(keysOf(item11, item12)).doesNotContainAnyElementsOf(keysOf(item21, item22, item23));
int countItems = qItemQueriesDao.countItems(params);
assertThat(countItems).isEqualTo(2);
}
use of org.olat.modules.qpool.QuestionStatus in project openolat by klemens.
the class QuestionPoolServiceImplTest method shouldSetNewStatusOnlyIfChanged.
@Test
public void shouldSetNewStatusOnlyIfChanged() {
QuestionStatus status = QuestionStatus.draft;
item.setQuestionStatus(status);
Float rating = new Float(RATING_FIVE);
ReviewDecision decision = new ReviewDecision(false, QuestionStatus.finalVersion);
when(reviewServiceMock.decideStatus(item, rating)).thenReturn(decision);
sut.rateItemInReview(item, identityDummy, rating, null);
assertThat(item.getQuestionStatus()).isEqualTo(status);
}
use of org.olat.modules.qpool.QuestionStatus in project openolat by klemens.
the class QuestionPoolServiceImplTest method shouldSetNewStatusIfChanged.
@Test
public void shouldSetNewStatusIfChanged() {
Float rating = new Float(RATING_FIVE);
QuestionStatus status = QuestionStatus.finalVersion;
ReviewDecision decision = new ReviewDecision(true, status);
when(reviewServiceMock.decideStatus(item, rating)).thenReturn(decision);
sut.rateItemInReview(item, identityDummy, rating, null);
assertThat(item.getQuestionStatus()).isEqualTo(status);
}
use of org.olat.modules.qpool.QuestionStatus in project openolat by klemens.
the class QuestionListController method doSetSourceStatus.
private void doSetSourceStatus(FormLink link) {
if (getSource().isStatusFilterEnabled()) {
QuestionStatus status = (QuestionStatus) link.getUserObject();
getSource().setStatusFilter(status);
getItemsTable().reset(true, true, true);
removeSelectionCssClass(statusDraftLink);
removeSelectionCssClass(statusReviewLink);
removeSelectionCssClass(statusRevisedLink);
removeSelectionCssClass(statusFinalLink);
removeSelectionCssClass(statusEndOfLifeLink);
setSelectionCssClass(link);
}
}
use of org.olat.modules.qpool.QuestionStatus in project openolat by klemens.
the class QuestionListController method updateStatusFilter.
public void updateStatusFilter() {
if (getSource().isStatusFilterEnabled()) {
QuestionStatus actualStatus = getSource().getStatusFilter();
reloadStatusFilterTitle(statusDraftLink, "source.status.draft");
reloadStatusFilterTitle(statusReviewLink, "source.status.review");
reloadStatusFilterTitle(statusRevisedLink, "source.status.revised");
reloadStatusFilterTitle(statusFinalLink, "source.status.finalVersion");
reloadStatusFilterTitle(statusEndOfLifeLink, "source.status.endOfLife");
getSource().setStatusFilter(actualStatus);
}
}
Aggregations