Forum

How to get all outcomeDeclarations of a Delivery

DevDev
edited April 2018 in Developers

Hi,
I've followed new extension guide and successfully created one. In this extension I need admin to configure for some messages for each outcomeDeclaration (Scoring type is TOTAL SCORE), which will be displayed in customized result report.
I have figured out from some checks that Assembled Delivery has its own copy of the QTITest definition once the Delivery created. Changes to the QtiTest definition will impact future Delivery definitions but not already existing ones.

Based on that, would you please give me a clue how to access all outcomeDeclaration with their basetype of specific Delivery.

Please note I have checked taoOutcomeUi code and find the code that get the oucomeDeclarations with their values, however this only works in case there is a result attached to a delivery. However, what needed is to get them from delivery definition itself.

Thanks for this great platform and thanks in advance for your support.

Comments

  • Hi,
    After traversing code of some modules, I have found the following:
    $assessmetTest = taoQtiTest_helpers_Utils->getTestDefinition($compilationUri)
    $outcomes = getOutcomeDelarations()

    is this true?
    The issue now is how to get $compilationUri of specific delivery?
    Many thanks.

  • DevDev
    edited April 2018

    Hi,
    I have done this

    public function getDeliveryCompilationUri($deliveryId)
            {
                $delivery = new core_kernel_classes_Resource($deliveryId);
                $containerJson = (string)$delivery->getOnePropertyValue(new \core_kernel_classes_Property(self::PROPERTY_CONTAINER));
                if (!empty($containerJson)) {
                    $jsonparams = json_decode($containerJson, true);
                    if (!isset($jsonparams['container']) || !isset($jsonparams['params'])) {
                       throw new \common_exception_InconsistentData('Invalid container json');
                    }
                    return $jsonparams["params"]["private"].'|'.$jsonparams["params"]["public"];
                }
                throw new \common_exception_InconsistentData('Invalid container json');
            }

    and then
    $compilationUri = $this->getDeliveryCompilationUri($delivery->getUri());
     $assessmetTest = \taoQtiTest_helpers_Utils::getTestDefinition($compilationUri);
     $outcomes = $assessmetTest->getOutcomeDeclarations();

    It works perfectly, but is there anyway to get the Max score of each category outcome variable from delivery itself not from its executions?
    Thanks in Advance.
  • Hi there,

    I don't really understand your question; what's the intent? what are you trying to do?
    If you're trying to get max scores per category, this can be retrieved by the QTI Results Reporting API (assuming you've configured category scoring on the test level). This is indeed on the execution level, as these can vary per execution (e.g. random selection of items).

    Thanks,

    Mark.

  • DevDev
    edited April 2018

    Hi Mark,
    Thanks for your reply.
    Exactly, I'm trying to get max scores per category for specific delivery as well as TOTAL_SCORE before execution.
    Thanks for pointing the "ransom selection of items for a test" case, as I wasn't aware of it. However, I don't have such case in defining tests. All tests have specific items and each item has only one category.

    Are there a way to get max score before delivery execution?

    My objective is to allow admin to define for each category a score range and for each range define color(Red, Yellow, Green) and text captions and result report will be based on those setups.

    Thanks in Advance,
    Dev

  • As these variables are computed at runtime (for reasons explained) the answer is no unfortunately, but what would be the problem in using the computed values from the delivery execution? If the test is truly static, you could always hardcode it of course, but I guess that's not an option.

    Thanks,

    Mark.

  • Thank you a lot for your reply.
    I think the best solution is to not allow admin to configure those setups until there's at least one execution.
    Many Thanks,
    Dev

Sign In or Register to comment.

We use cookies on our website to support technical features that enhance your user experience. Cookie Policy Privacy Policy

×