Fraction Model - Example 2

Fraction Model interactions are triggered by specifying the following QTI Custom Interaction class attribute:
<customInteraction class="tei-fractionmodel" responseIdentifier="RESPONSE">

The QTI schema of a Fraction Model customInteraction contains only one element, <customOption>, which contains an object that describes everything about the interaction, including the number and type of models inside the interaction. Inside the configuration object there is a models array which defines properties of each Fraction Model "model" in an interaction, including startSegments, minSegments, maxSegments, radius, title text, and more.

The following is a complete <customOption> configuration object example of a models definition with three models. Note how the first model is specified as being inactive active: false:

<customOption><![CDATA[
{
  div: 'interaction-RESPONSE',
  stem_div: 'stem',
  alignment: 'center',
  models: [
    {
      active: false,
      startSegments: 4,
      minSegments: 1,
      maxSegments: 4,
      selectedSegments: [1, 2],
      text: 'Circle A',
      style: {
        radius: 125,
        fillColor: '#7D8FF5',
        strokeColor: '#000000',
        strokeWeight: 2
      }
    },
    {
      active: true,
      startSegments: 2,
      minSegments: 2,
      maxSegments: 12,
      selectedSegments: [],
      text: 'Circle B',
      style: {
        radius: 125,
        fillColor: '#E01BC6',
        strokeColor: '#000000',
        strokeWeight: 2
      }
    },
    {
      active: true,
      startSegments: 2,
      minSegments: 2,
      maxSegments: 12,
      selectedSegments: [],
      text: 'Circle C',
      style: {
        radius: 125,
        fillColor: '#B35FE3',
        strokeColor: '#000000',
        strokeWeight: 2
      }
    }
  ]
}
]]></customOption>
Get Responses:[ Click Get Responses ]
<?xml version="1.0" encoding="utf-8"?>
<assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p1 http://www.imsglobal.org/xsd/imsqti_v2p1.xsd"
	adaptive="false" timeDependent="false" identifier="customInteraction-fractionmodel-2" title="Fraction Model - Example 2">

	<responseDeclaration identifier="RESPONSE" cardinality="ordered" baseType="string">
		<correctResponse>
			<value>4/8</value>
			<value>1/2</value>
		</correctResponse>
	</responseDeclaration>
	
	<outcomeDeclaration identifier="SCORE" cardinality="single" baseType="float" />
	
	<templateDeclaration cardinality="single" baseType="string" identifier="REFERENCE_FRACTION">
		<defaultValue>
			<value>2/4</value>
		</defaultValue>
	</templateDeclaration>

	<itemBody>
		<div id="model"></div>
		<customInteraction class="tei-fractionmodel" responseIdentifier="RESPONSE">
			<prcqti:fractionInteraction xmlns:prcqti="prcqti">
				<customOption><![CDATA[
					{
						div: 'model',
						stem_div: 'stem',
						alignment: 'center',
						models: [      
							{
								active: false,
								startSegments: 6,
								minSegments: 1,
								maxSegments: 4,
								selectedSegments: [1, 2],
								text: 'Circle A',
								style: {
									radius: 125,
									fillColor: '#7D8FF5',
									strokeColor: '#000000',
									strokeWeight: 2
								}
							},
							{
								active: true,
								startSegments: 2,
								minSegments: 2,
								maxSegments: 12,
								selectedSegments: [],
								text: 'Circle B',
								style: {
									radius: 125,
									fillColor: '#E01BC6',
									strokeColor: '#000000',
									strokeWeight: 2
								}
							},
							{
								active: true,
								startSegments: 2,
								minSegments: 2,
								maxSegments: 12,
								selectedSegments: [],
								text: 'Circle C',
								style: {
									radius: 125,
									fillColor: '#B35FE3',
									strokeColor: '#000000',
									strokeWeight: 2
								}
							}
						]
					}
				]]></customOption>
			</prcqti:fractionInteraction>
		</customInteraction>
	</itemBody>

	<responseProcessing>
		<responseCondition>
			<responseIf>
				<and>
					<!-- Fraction Model 1: equivalent fraction but numerator larger than reference. -->
					<and>
						<equal toleranceMode="absolute" tolerance="0.000000000001">
							<divide>
								<customOperator class="qti.customOperators.math.fraction.Numerator">
									<index n="1">
										<variable identifier="RESPONSE"/>
									</index>
								</customOperator>
								<customOperator class="qti.customOperators.math.fraction.Denominator">
									<index n="1">
										<variable identifier="RESPONSE"/>
									</index>
								</customOperator>
							</divide>
							<divide>
								<customOperator class="qti.customOperators.math.fraction.Numerator">
									<variable identifier="REFERENCE_FRACTION"/>
								</customOperator>
								<customOperator class="qti.customOperators.math.fraction.Denominator">
									<variable identifier="REFERENCE_FRACTION"/>
								</customOperator>
							</divide>
						</equal>
						<gt>
							<customOperator class="qti.customOperators.math.fraction.Numerator">
								<index n="1">
									<variable identifier="RESPONSE"/>
								</index>
							</customOperator>
							<customOperator class="qti.customOperators.math.fraction.Numerator">
								<variable identifier="REFERENCE_FRACTION"/>
							</customOperator>
						</gt>
					</and>
					
					<!-- Fraction Model 2: equivalent fraction but numerator smaller than reference. -->
					<and>
						<equal toleranceMode="absolute" tolerance="0.000000000001">
							<divide>
								<customOperator class="qti.customOperators.math.fraction.Numerator">
									<index n="2">
										<variable identifier="RESPONSE"/>
									</index>
								</customOperator>
								<customOperator class="qti.customOperators.math.fraction.Denominator">
									<index n="2">
										<variable identifier="RESPONSE"/>
									</index>
								</customOperator>
							</divide>
							<divide>
								<customOperator class="qti.customOperators.math.fraction.Numerator">
									<variable identifier="REFERENCE_FRACTION"/>
								</customOperator>
								<customOperator class="qti.customOperators.math.fraction.Denominator">
									<variable identifier="REFERENCE_FRACTION"/>
								</customOperator>
							</divide>
						</equal>
						<lt>
							<customOperator class="qti.customOperators.math.fraction.Numerator">
								<index n="2">
									<variable identifier="RESPONSE"/>
								</index>
							</customOperator>
							<customOperator class="qti.customOperators.math.fraction.Numerator">
								<variable identifier="REFERENCE_FRACTION"/>
							</customOperator>
						</lt>
					</and>
				</and>
				<setOutcomeValue identifier="SCORE">
					<baseValue baseType="float">1</baseValue>
				</setOutcomeValue>
			</responseIf>
			<responseElse>
				<setOutcomeValue identifier="SCORE">
					<baseValue baseType="float">0</baseValue>
				</setOutcomeValue>
			</responseElse>
		</responseCondition>
	</responseProcessing>
	
</assessmentItem>

Use Circle B to create a fraction that is equivalent to what is shown in Circle A but with a larger numerator. Use Circle C to create a fraction that is equivalent to what is shown in Circle A but with a smaller numerator.