mario-education 2.4.245-release → 2.4.247-release

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -132,5 +132,5 @@ export declare const filterYearData: {
132
132
  startDate: number;
133
133
  endDate: number;
134
134
  }[];
135
- export declare const handleAveraged: (points: number[]) => number;
136
- export declare const handleGenerateAvgQuestion: (data: number[], avgContent?: string | undefined) => string;
135
+ export declare const handleAveraged: (points: number[], isStress?: boolean | undefined) => number;
136
+ export declare const handleGenerateAvgQuestion: (data: number[], isStress: boolean, avgContent?: string | undefined) => string;
@@ -6,8 +6,8 @@ export declare const average: (arr: number[]) => number;
6
6
  export declare const convertDataToDataChart: (data: IOverviewQuestionChoice[]) => string[];
7
7
  export declare const overallDonutCHartOptions: (labelNames: string[], colors: string[], isCountSeries?: boolean | undefined, textColors?: string[] | undefined) => ApexOptions;
8
8
  export declare const learningStrategyChartOptions: (labelNames: any, usageCountList: number[], isMobileScreen: boolean) => ApexOptions;
9
- export declare const readinesToLearnoptions: (seriesName: string[], redirectStudentOverview?: Function | undefined, isStudent?: boolean | undefined, colors?: string[] | undefined) => ApexOptions;
10
- export declare const convertDataToSeriesBullderChart: (data: IReadinessToLearning[], chartWidth: number) => {
9
+ export declare const readinesToLearnoptions: (seriesName: string[], redirectStudentOverview?: Function | undefined, isStudent?: boolean | undefined, colors?: string[] | undefined, isStudentResponses?: boolean | undefined) => ApexOptions;
10
+ export declare const convertDataToSeriesBullderChart: (data: IReadinessToLearning[], chartWidth: number, isStudentResponses?: boolean | undefined) => {
11
11
  name: string;
12
12
  data: import("react").ReactText[][];
13
13
  }[];
@@ -7,6 +7,7 @@ interface IProps {
7
7
  disableSeriesName?: boolean;
8
8
  colors?: string[];
9
9
  indexActive?: number[];
10
+ isStudentResponses?: boolean;
10
11
  }
11
- declare const _default: React.MemoExoticComponent<({ data, isPlp, print, disableSeriesName, colors, indexActive }: IProps) => JSX.Element>;
12
+ declare const _default: React.MemoExoticComponent<({ data, isPlp, print, disableSeriesName, colors, indexActive, isStudentResponses }: IProps) => JSX.Element>;
12
13
  export default _default;
package/dist/index.js CHANGED
@@ -29410,16 +29410,16 @@ var filterYearData = [{
29410
29410
  startDate: moment().utc().add(-1, "days").startOf("day").valueOf(),
29411
29411
  endDate: moment().utc().add(-1, "days").endOf("day").valueOf()
29412
29412
  }];
29413
- var handleAveraged = function handleAveraged(points) {
29413
+ var handleAveraged = function handleAveraged(points, isStress) {
29414
29414
  var total = points.reduce(function (acc, cur) {
29415
- return acc + cur;
29415
+ return acc + (!isStress ? cur : (cur - 50) * 2);
29416
29416
  }, 0);
29417
29417
  return total / points.length;
29418
29418
  };
29419
- var handleGenerateAvgQuestion = function handleGenerateAvgQuestion(data, avgContent) {
29419
+ var handleGenerateAvgQuestion = function handleGenerateAvgQuestion(data, isStress, avgContent) {
29420
29420
  var _handleAveraged$toFix, _handleAveraged, _data$reduce;
29421
29421
 
29422
- return !avgContent ? "AVR. " + ((_handleAveraged$toFix = (_handleAveraged = handleAveraged(data)) === null || _handleAveraged === void 0 ? void 0 : _handleAveraged.toFixed(2)) != null ? _handleAveraged$toFix : 0) + "%" : ((_data$reduce = data.reduce(function (accumulator, currentValue) {
29422
+ return !avgContent ? "AVR. " + ((_handleAveraged$toFix = (_handleAveraged = handleAveraged(data, isStress)) === null || _handleAveraged === void 0 ? void 0 : _handleAveraged.toFixed(2)) != null ? _handleAveraged$toFix : 0) + "%" : ((_data$reduce = data.reduce(function (accumulator, currentValue) {
29423
29423
  return accumulator + currentValue;
29424
29424
  }, 0)) != null ? _data$reduce : 0) + " " + avgContent;
29425
29425
  };
@@ -31267,7 +31267,7 @@ var GenerateChartData = function GenerateChartData(_ref) {
31267
31267
  className: "" + styles$1["label-chart"]
31268
31268
  }, t(item.name.toLocaleLowerCase()))), React__default.createElement("p", {
31269
31269
  className: "" + styles$1["avr-question"]
31270
- }, "" + ((_handleGenerateAvgQue = handleGenerateAvgQuestion(item.data, avgContent)) != null ? _handleGenerateAvgQue : 0)), React__default.createElement("div", {
31270
+ }, "" + ((_handleGenerateAvgQue = handleGenerateAvgQuestion(item.data, min == -100, avgContent)) != null ? _handleGenerateAvgQue : 0)), React__default.createElement("div", {
31271
31271
  hidden: avgs.length == 0 || !timeOfDay,
31272
31272
  className: "" + styles$1["volatility"]
31273
31273
  }, avgs[index] < 0 ? React__default.createElement("div", {
@@ -47619,7 +47619,31 @@ var overallDonutCHartOptions$1 = function overallDonutCHartOptions(labelNames, c
47619
47619
  }
47620
47620
  };
47621
47621
  };
47622
- var readinesToLearnoptions$1 = function readinesToLearnoptions(seriesName, redirectStudentOverview, isStudent, colors) {
47622
+ var readinesToLearnoptions$1 = function readinesToLearnoptions(seriesName, redirectStudentOverview, isStudent, colors, isStudentResponses) {
47623
+ var configToolTip = {
47624
+ enabled: true,
47625
+ x: {
47626
+ show: false
47627
+ },
47628
+ y: {
47629
+ formatter: undefined,
47630
+ title: {
47631
+ formatter: function formatter() {
47632
+ return "Percent";
47633
+ }
47634
+ }
47635
+ }
47636
+ };
47637
+
47638
+ if (!isStudentResponses) {
47639
+ configToolTip = Object.assign(configToolTip, {
47640
+ z: {
47641
+ formatter: undefined,
47642
+ title: "Student: "
47643
+ }
47644
+ });
47645
+ }
47646
+
47623
47647
  return {
47624
47648
  chart: {
47625
47649
  height: 250,
@@ -47690,24 +47714,7 @@ var readinesToLearnoptions$1 = function readinesToLearnoptions(seriesName, redir
47690
47714
  }
47691
47715
  }
47692
47716
  },
47693
- tooltip: {
47694
- enabled: true,
47695
- x: {
47696
- show: false
47697
- },
47698
- y: {
47699
- formatter: undefined,
47700
- title: {
47701
- formatter: function formatter() {
47702
- return "Percent";
47703
- }
47704
- }
47705
- },
47706
- z: {
47707
- formatter: undefined,
47708
- title: "Student: "
47709
- }
47710
- },
47717
+ tooltip: configToolTip,
47711
47718
  labels: [],
47712
47719
  legend: {
47713
47720
  show: false,
@@ -47722,15 +47729,17 @@ var readinesToLearnoptions$1 = function readinesToLearnoptions(seriesName, redir
47722
47729
  }
47723
47730
  };
47724
47731
  };
47725
- var convertDataToSeriesBullderChart$1 = function convertDataToSeriesBullderChart(data, chartWidth) {
47732
+ var convertDataToSeriesBullderChart$1 = function convertDataToSeriesBullderChart(data, chartWidth, isStudentResponses) {
47726
47733
  var widthItem = (chartWidth - 400) / data.length;
47727
47734
  return data.map(function (i, index) {
47728
- var _i$studentPercentQues;
47735
+ var _i$studentPercentQues, _i$studentPercentQues2;
47729
47736
 
47730
47737
  return {
47731
47738
  name: i.questionText.replace("<p>", "").replace("</p>", ""),
47732
- data: ((_i$studentPercentQues = i.studentPercentQuestion) === null || _i$studentPercentQues === void 0 ? void 0 : _i$studentPercentQues.map(function (question) {
47739
+ data: !isStudentResponses ? (_i$studentPercentQues = i.studentPercentQuestion) === null || _i$studentPercentQues === void 0 ? void 0 : _i$studentPercentQues.map(function (question) {
47733
47740
  return [getRandomArbitrary$1(index * widthItem + widthItem * (30 / 100), (index + 1) * widthItem - widthItem * (30 / 100)), question.percentQuestion, question.studentName, question.studentId];
47741
+ }) : ((_i$studentPercentQues2 = i.studentPercentQuestion) === null || _i$studentPercentQues2 === void 0 ? void 0 : _i$studentPercentQues2.map(function (question) {
47742
+ return [getRandomArbitrary$1(index * widthItem + widthItem * (30 / 100), (index + 1) * widthItem - widthItem * (30 / 100)), question.percentQuestion];
47734
47743
  })) || []
47735
47744
  };
47736
47745
  });
@@ -48092,7 +48101,8 @@ var BubbleChartCustom$2 = function BubbleChartCustom(_ref) {
48092
48101
  print = _ref.print,
48093
48102
  disableSeriesName = _ref.disableSeriesName,
48094
48103
  colors = _ref.colors,
48095
- indexActive = _ref.indexActive;
48104
+ indexActive = _ref.indexActive,
48105
+ isStudentResponses = _ref.isStudentResponses;
48096
48106
  var history = reactRouterDom.useHistory();
48097
48107
 
48098
48108
  var _useTranslation = marioCore.useTranslation(),
@@ -48157,9 +48167,9 @@ var BubbleChartCustom$2 = function BubbleChartCustom(_ref) {
48157
48167
  }, React__default.createElement("div", {
48158
48168
  ref: chartRef
48159
48169
  }, React__default.createElement(Chart, {
48160
- options: readinesToLearnoptions$1(seriesName, redirectStudentOverview, isStudent, colors),
48170
+ options: readinesToLearnoptions$1(seriesName, redirectStudentOverview, isStudent, colors, isStudentResponses),
48161
48171
  type: "scatter",
48162
- series: convertDataToSeriesBullderChart$1(data, chartWidth),
48172
+ series: convertDataToSeriesBullderChart$1(data, chartWidth, isStudentResponses),
48163
48173
  width: "100%",
48164
48174
  height: 250
48165
48175
  })))), React__default.createElement("div", {
@@ -49195,6 +49205,7 @@ var SurveyDetailAdmin = function SurveyDetailAdmin() {
49195
49205
  print: true,
49196
49206
  disableSeriesName: true,
49197
49207
  colors: ratingOfQuestionColors,
49208
+ isStudentResponses: tabIndex != 0,
49198
49209
  data: distributionSeries.filter(function (_r, index) {
49199
49210
  return activeColumnDistribution[index] == true;
49200
49211
  }) || [],