fix: inverted binary forecasts, fixes #76
This commit is contained in:
parent
6aef1bc437
commit
42f3160abe
|
@ -113,29 +113,30 @@ export const QuestionOptions: React.FC<{ options: Option[] }> = ({
|
||||||
options.length === 2 &&
|
options.length === 2 &&
|
||||||
(options[0].name === "Yes" || options[0].name === "No");
|
(options[0].name === "Yes" || options[0].name === "No");
|
||||||
|
|
||||||
const optionsSorted = options.sort((a, b) => b.probability - a.probability);
|
|
||||||
const optionsMax5 = !!optionsSorted.slice ? optionsSorted.slice(0, 5) : []; // display max 5 options.
|
|
||||||
|
|
||||||
if (isBinary) {
|
if (isBinary) {
|
||||||
|
const yesOption = options.find((o) => o.name === "Yes");
|
||||||
return (
|
return (
|
||||||
<div className="space-x-2">
|
<div className="space-x-2">
|
||||||
<span
|
<span
|
||||||
className={`${primaryForecastColor(
|
className={`${primaryForecastColor(
|
||||||
options[0].probability
|
yesOption.probability
|
||||||
)} text-white w-16 rounded-md px-1.5 py-0.5 font-bold`}
|
)} text-white w-16 rounded-md px-1.5 py-0.5 font-bold`}
|
||||||
>
|
>
|
||||||
{formatProbability(options[0].probability)}
|
{formatProbability(yesOption.probability)}
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
className={`${textColor(
|
className={`${textColor(
|
||||||
options[0].probability
|
yesOption.probability
|
||||||
)} text-gray-500 inline-block`}
|
)} text-gray-500 inline-block`}
|
||||||
>
|
>
|
||||||
{primaryEstimateAsText(options[0].probability)}
|
{primaryEstimateAsText(yesOption.probability)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
const optionsSorted = options.sort((a, b) => b.probability - a.probability);
|
||||||
|
const optionsMax5 = !!optionsSorted.slice ? optionsSorted.slice(0, 5) : []; // display max 5 options.
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
{optionsMax5.map((option, i) => (
|
{optionsMax5.map((option, i) => (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user