Search in sources :

Example 6 with QuestionStatus

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);
}
Also used : QuestionStatus(org.olat.modules.qpool.QuestionStatus) QuestionItemImpl(org.olat.modules.qpool.model.QuestionItemImpl) SearchQuestionItemParams(org.olat.modules.qpool.model.SearchQuestionItemParams) QuestionItemView(org.olat.modules.qpool.QuestionItemView) QuestionItem(org.olat.modules.qpool.QuestionItem) Test(org.junit.Test)

Example 7 with QuestionStatus

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);
}
Also used : ReviewDecision(org.olat.modules.qpool.model.ReviewDecision) QuestionStatus(org.olat.modules.qpool.QuestionStatus) Test(org.junit.Test)

Example 8 with QuestionStatus

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);
}
Also used : ReviewDecision(org.olat.modules.qpool.model.ReviewDecision) QuestionStatus(org.olat.modules.qpool.QuestionStatus) Test(org.junit.Test)

Example 9 with QuestionStatus

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);
    }
}
Also used : QuestionStatus(org.olat.modules.qpool.QuestionStatus)

Example 10 with QuestionStatus

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);
    }
}
Also used : QuestionStatus(org.olat.modules.qpool.QuestionStatus)

Aggregations

QuestionStatus (org.olat.modules.qpool.QuestionStatus)20 Test (org.junit.Test)6 QuestionItem (org.olat.modules.qpool.QuestionItem)4 QuestionItemImpl (org.olat.modules.qpool.model.QuestionItemImpl)4 ReviewDecision (org.olat.modules.qpool.model.ReviewDecision)4 Date (java.util.Date)2 Dropdown (org.olat.core.gui.components.dropdown.Dropdown)2 Link (org.olat.core.gui.components.link.Link)2 QuestionItemView (org.olat.modules.qpool.QuestionItemView)2 SearchQuestionItemParams (org.olat.modules.qpool.model.SearchQuestionItemParams)2