From aa409441b06c2582b8218e8cff93a1b9f90a6eca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eneko=20Uru=C3=B1uela?= Date: Wed, 16 Feb 2022 16:39:34 +0100 Subject: [PATCH 1/3] Fix missing figure bug --- package.json | 2 +- src/Plots/Plots.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index b47b302..9bb7374 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rica", - "version": "1.0.7", + "version": "1.0.8", "private": true, "dependencies": { "@fortawesome/fontawesome-svg-core": "^1.2.36", diff --git a/src/Plots/Plots.js b/src/Plots/Plots.js index d5efef6..914dd42 100644 --- a/src/Plots/Plots.js +++ b/src/Plots/Plots.js @@ -182,7 +182,7 @@ class Plots extends React.Component { // Get component name of selected component var compName = this.state.variance.labels[index].match(/\d/g); compName = compName.join(""); - compName = `comp_0${compName}.png`; + compName = `comp_${compName}.png`; // iterate over each element in the array to retrieve image of selected component based on name for (var i = 0; i < this.props.componentFigures.length; i++) { @@ -228,7 +228,7 @@ class Plots extends React.Component { // Get component name of selected component var compName = this.state.kappaRho.labels[index].match(/\d/g); compName = compName.join(""); - compName = `comp_0${compName}.png`; + compName = `comp_${compName}.png`; // iterate over each element in the array to retrieve image of selected component based on name for (var i = 0; i < this.props.componentFigures.length; i++) { From 92570497b08f98ac5feb717ac470fcd8f240794d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eneko=20Uru=C3=B1uela?= Date: Wed, 16 Feb 2022 16:54:14 +0100 Subject: [PATCH 2/3] Actually fix the bug Apparently, the previous commit would only work when the number of components was greater than 100 --- src/Plots/Plots.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Plots/Plots.js b/src/Plots/Plots.js index 914dd42..aec34f8 100644 --- a/src/Plots/Plots.js +++ b/src/Plots/Plots.js @@ -182,6 +182,10 @@ class Plots extends React.Component { // Get component name of selected component var compName = this.state.variance.labels[index].match(/\d/g); compName = compName.join(""); + // If length of compName is 2, then add a 0 to the beginning + if (compName.length === 2) { + compName = `0${compName}`; + } compName = `comp_${compName}.png`; // iterate over each element in the array to retrieve image of selected component based on name @@ -228,6 +232,10 @@ class Plots extends React.Component { // Get component name of selected component var compName = this.state.kappaRho.labels[index].match(/\d/g); compName = compName.join(""); + // If length of compName is 2, then add a 0 to the beginning + if (compName.length === 2) { + compName = `0${compName}`; + } compName = `comp_${compName}.png`; // iterate over each element in the array to retrieve image of selected component based on name From 92f3c2918c257ce4ba790371b1fd938cc78bb102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eneko=20Uru=C3=B1uela?= Date: Wed, 16 Feb 2022 17:04:25 +0100 Subject: [PATCH 3/3] Change the way the component name is updated --- src/Plots/Plots.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Plots/Plots.js b/src/Plots/Plots.js index aec34f8..0f3d568 100644 --- a/src/Plots/Plots.js +++ b/src/Plots/Plots.js @@ -184,7 +184,7 @@ class Plots extends React.Component { compName = compName.join(""); // If length of compName is 2, then add a 0 to the beginning if (compName.length === 2) { - compName = `0${compName}`; + compName = "0" + compName; } compName = `comp_${compName}.png`; @@ -234,7 +234,7 @@ class Plots extends React.Component { compName = compName.join(""); // If length of compName is 2, then add a 0 to the beginning if (compName.length === 2) { - compName = `0${compName}`; + compName = "0" + compName; } compName = `comp_${compName}.png`;