Search in sources :

Example 1 with QuestionStatus

use of org.olat.modules.qpool.QuestionStatus in project OpenOLAT by OpenOLAT.

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 2 with QuestionStatus

use of org.olat.modules.qpool.QuestionStatus in project OpenOLAT by OpenOLAT.

the class QuestionItemDetailsController method buildStatusDrowdown.

private Dropdown buildStatusDrowdown() {
    QuestionStatus actualStatus = metadatasCtrl.getItem().getQuestionStatus();
    Dropdown statusDropdown = new Dropdown("process.states", "lifecycle.status." + actualStatus.name(), false, getTranslator());
    statusDropdown.setElementCssClass("o_qpool_tools_status o_qpool_status_" + actualStatus.name());
    statusDropdown.setIconCSS("o_icon o_icon-fw o_icon_qitem_" + actualStatus.name());
    statusDropdown.setOrientation(DropdownOrientation.normal);
    statusDraftLink = LinkFactory.createToolLink("lifecycle.status.draft", translate("lifecycle.status.draft"), this);
    statusDraftLink.setIconLeftCSS("o_icon o_icon-fw o_icon_qitem_draft");
    statusDraftLink.setElementCssClass("o_labeled o_qpool_status o_qpool_status_draft");
    statusDraftLink.setVisible(qItemSecurityCallback.canSetDraft() && !QuestionStatus.draft.equals(actualStatus));
    statusDropdown.addComponent(statusDraftLink);
    statusRevisedLink = LinkFactory.createToolLink("lifecycle.status.revised", translate("lifecycle.status.revised"), this);
    statusRevisedLink.setIconLeftCSS("o_icon o_icon-fw o_icon_qitem_revised");
    statusRevisedLink.setElementCssClass("o_labeled o_qpool_status o_qpool_status_revised");
    statusRevisedLink.setVisible(qItemSecurityCallback.canSetRevised() && !QuestionStatus.revised.equals(actualStatus));
    statusDropdown.addComponent(statusRevisedLink);
    statusReviewLink = LinkFactory.createToolLink("lifecycle.status.review", translate("lifecycle.status.review"), this);
    statusReviewLink.setIconLeftCSS("o_icon o_icon-fw o_icon_qitem_review");
    statusReviewLink.setElementCssClass("o_labeled o_qpool_status o_qpool_status_review");
    statusReviewLink.setVisible(qItemSecurityCallback.canSetReview() && !QuestionStatus.review.equals(actualStatus));
    statusDropdown.addComponent(statusReviewLink);
    statusFinalLink = LinkFactory.createToolLink("lifecycle.status.finalVersion", translate("lifecycle.status.finalVersion"), this);
    statusFinalLink.setIconLeftCSS("o_icon o_icon-fw o_icon_qitem_finalVersion");
    statusFinalLink.setElementCssClass("o_labeled o_qpool_status o_qpool_status_finalVersion");
    statusFinalLink.setVisible(qItemSecurityCallback.canSetFinal() && !QuestionStatus.finalVersion.equals(actualStatus));
    statusDropdown.addComponent(statusFinalLink);
    statusEndOfLifeLink = LinkFactory.createToolLink("lifecycle.status.endOfLife", translate("lifecycle.status.endOfLife"), this);
    statusEndOfLifeLink.setIconLeftCSS("o_icon o_icon-fw o_icon_qitem_endOfLife");
    statusEndOfLifeLink.setElementCssClass("o_labeled o_qpool_status o_qpool_status_endOfLife");
    statusEndOfLifeLink.setVisible(qItemSecurityCallback.canSetEndOfLife() && !QuestionStatus.endOfLife.equals(actualStatus));
    statusDropdown.addComponent(statusEndOfLifeLink);
    return statusDropdown;
}
Also used : QuestionStatus(org.olat.modules.qpool.QuestionStatus) Dropdown(org.olat.core.gui.components.dropdown.Dropdown)

Example 3 with QuestionStatus

use of org.olat.modules.qpool.QuestionStatus in project OpenOLAT by OpenOLAT.

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)

Example 4 with QuestionStatus

use of org.olat.modules.qpool.QuestionStatus in project OpenOLAT by OpenOLAT.

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 5 with QuestionStatus

use of org.olat.modules.qpool.QuestionStatus in project OpenOLAT by OpenOLAT.

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)

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