Skip to content

Commit

Permalink
rename labelImageScoreMarker
Browse files Browse the repository at this point in the history
  • Loading branch information
handeyeco committed Jan 17, 2025
1 parent b529ba7 commit 08b247b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/perseus-score/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export {default as scoreDropdown} from "./widgets/dropdown/score-dropdown";
export {default as scoreIframe} from "./widgets/iframe/score-iframe";
export {
default as scoreLabelImage,
labelImageScoreMarker,
scoreLabelImageMarker,
} from "./widgets/label-image/score-label-image";
export {default as scoreMatcher} from "./widgets/matcher/score-matcher";
export {default as scoreNumberLine} from "./widgets/number-line/score-number-line";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import scoreLabelImage, {labelImageScoreMarker} from "./score-label-image";
import scoreLabelImage, {scoreLabelImageMarker} from "./score-label-image";

const emptyMarker = {
label: "",
Expand All @@ -8,9 +8,9 @@ const emptyMarker = {
y: 0,
} as const;

describe("labelImageScoreMarker", function () {
describe("scoreLabelImageMarker", function () {
it("should score correct for empty marker with no user answers", function () {
const score = labelImageScoreMarker({
const score = scoreLabelImageMarker({
...emptyMarker,
});

Expand All @@ -21,7 +21,7 @@ describe("labelImageScoreMarker", function () {
});

it("should score incorrect for empty marker with user answer", function () {
const score = labelImageScoreMarker({
const score = scoreLabelImageMarker({
...emptyMarker,
selected: ["Fiat"],
});
Expand All @@ -33,7 +33,7 @@ describe("labelImageScoreMarker", function () {
});

it("should score incorrect for no user answers", function () {
const score = labelImageScoreMarker({
const score = scoreLabelImageMarker({
...emptyMarker,
answers: ["Lamborghini", "Fiat", "Ferrari"],
});
Expand All @@ -45,7 +45,7 @@ describe("labelImageScoreMarker", function () {
});

it("should score incorrect for wrong user answers", function () {
const score = labelImageScoreMarker({
const score = scoreLabelImageMarker({
...emptyMarker,
answers: ["Lamborghini", "Fiat", "Ferrari"],
selected: ["Fiat", "Ferrari"],
Expand All @@ -58,7 +58,7 @@ describe("labelImageScoreMarker", function () {
});

it("should score correct for user answers", function () {
const score = labelImageScoreMarker({
const score = scoreLabelImageMarker({
...emptyMarker,
answers: ["Lamborghini", "Fiat", "Ferrari"],
selected: ["Lamborghini", "Fiat", "Ferrari"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type InteractiveMarkerScore = {
isCorrect: boolean;
};

export function labelImageScoreMarker(
export function scoreLabelImageMarker(
marker: InteractiveMarkerType,
): InteractiveMarkerScore {
const score = {
Expand Down Expand Up @@ -52,7 +52,7 @@ function scoreLabelImage(
let numCorrect = 0;

for (const marker of userInput.markers) {
const score = labelImageScoreMarker(marker);
const score = scoreLabelImageMarker(marker);

if (score.hasAnswers) {
numAnswered++;
Expand Down
6 changes: 3 additions & 3 deletions packages/perseus/src/widgets/label-image/label-image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import {
labelImageScoreMarker,
scoreLabelImageMarker,
scoreLabelImage,
type PerseusLabelImageRubric,
type PerseusLabelImageUserInput,
Expand Down Expand Up @@ -327,7 +327,7 @@ export class LabelImage
const {onChange} = this.props;

const updatedMarkers = markers.map((marker) => {
const score = labelImageScoreMarker(marker);
const score = scoreLabelImageMarker(marker);

return {
...marker,
Expand Down Expand Up @@ -479,7 +479,7 @@ export class LabelImage
}[markerPosition];
}

const score = labelImageScoreMarker(marker);
const score = scoreLabelImageMarker(marker);
// Once the question is answered, show markers
// with correct answers, otherwise passthrough
// the correctness state.
Expand Down

0 comments on commit 08b247b

Please sign in to comment.