Browse Source

fix: Fixed study site order with in-between sites.

master
Denis Thiessen 6 months ago
parent
commit
542b96b154
  1. 15
      src/App.js

15
src/App.js

@ -51,7 +51,7 @@ const getLatinSquareOrder = function(participantNumber) {
const latinSquareElement = latinSquare[latinSquareIndex]; const latinSquareElement = latinSquare[latinSquareIndex];
const originalOrder = [1, 2, 3, 4, 5, 6]; const originalOrder = [1, 2, 3, 4, 5, 6];
var latinSquareRedirectOrder = []; var latinSquareRedirectOrder = [];
latinSquareRedirectOrder.push(("study-page-" + latinSquareElement[0]));
latinSquareRedirectOrder.push(("in-between-" + latinSquareElement[0]));
for(var originalOrderElement of originalOrder) { for(var originalOrderElement of originalOrder) {
const indexElement = findIndexOfOrderElement(originalOrderElement, latinSquareElement); const indexElement = findIndexOfOrderElement(originalOrderElement, latinSquareElement);
@ -63,7 +63,7 @@ const getLatinSquareOrder = function(participantNumber) {
const nextOrderElement = latinSquareElement[(indexElement + 1)]; const nextOrderElement = latinSquareElement[(indexElement + 1)];
const nextOrderElementIndex = findIndexOfOrderElement(nextOrderElement, latinSquareElement); const nextOrderElementIndex = findIndexOfOrderElement(nextOrderElement, latinSquareElement);
const nextRedirctElement = latinSquareElement[nextOrderElementIndex]; const nextRedirctElement = latinSquareElement[nextOrderElementIndex];
latinSquareRedirectOrder.push(("study-page-" + nextRedirctElement ));
latinSquareRedirectOrder.push(("in-between-" + nextRedirctElement ));
} }
return latinSquareRedirectOrder; return latinSquareRedirectOrder;
@ -95,16 +95,17 @@ function App() {
<RouteTracker /> <RouteTracker />
<Routes> <Routes>
<Route path="/" element={<React.Suspense fallback={<>...</>}><TestInfoPage redirectLoc={latinSquareOrder[0]}/></React.Suspense>} /> <Route path="/" element={<React.Suspense fallback={<>...</>}><TestInfoPage redirectLoc={latinSquareOrder[0]}/></React.Suspense>} />
<Route path="/in-between-1" element={<React.Suspense fallback={<>...</>}><TestInfoPage redirectLoc="study-page-1"/></React.Suspense>} />
<Route path="/study-page-1" element={<React.Suspense fallback={<>...</>}><TestPage redirectLoc={latinSquareOrder[1]}/></React.Suspense>} /> <Route path="/study-page-1" element={<React.Suspense fallback={<>...</>}><TestPage redirectLoc={latinSquareOrder[1]}/></React.Suspense>} />
<Route path="/in-between-1" element={<React.Suspense fallback={<>...</>}><TestInfoPage redirectLoc="study-page-2"/></React.Suspense>} />
<Route path="/in-between-2" element={<React.Suspense fallback={<>...</>}><TestInfoPage redirectLoc="study-page-2"/></React.Suspense>} />
<Route path="/study-page-2" element={<React.Suspense fallback={<>...</>}><TestPage redirectLoc={latinSquareOrder[2]}/></React.Suspense>} /> <Route path="/study-page-2" element={<React.Suspense fallback={<>...</>}><TestPage redirectLoc={latinSquareOrder[2]}/></React.Suspense>} />
<Route path="/in-between-2" element={<React.Suspense fallback={<>...</>}><TestInfoPage redirectLoc="study-page-3"/></React.Suspense>} />
<Route path="/in-between-3" element={<React.Suspense fallback={<>...</>}><TestInfoPage redirectLoc="study-page-3"/></React.Suspense>} />
<Route path="/study-page-3" element={<React.Suspense fallback={<>...</>}><TestPage redirectLoc={latinSquareOrder[3]}/></React.Suspense>} /> <Route path="/study-page-3" element={<React.Suspense fallback={<>...</>}><TestPage redirectLoc={latinSquareOrder[3]}/></React.Suspense>} />
<Route path="/in-between-3" element={<React.Suspense fallback={<>...</>}><TestInfoPage redirectLoc="study-page-4"/></React.Suspense>} />
<Route path="/in-between-4" element={<React.Suspense fallback={<>...</>}><TestInfoPage redirectLoc="study-page-4"/></React.Suspense>} />
<Route path="/study-page-4" element={<React.Suspense fallback={<>...</>}><TestPage redirectLoc={latinSquareOrder[4]}/></React.Suspense>} /> <Route path="/study-page-4" element={<React.Suspense fallback={<>...</>}><TestPage redirectLoc={latinSquareOrder[4]}/></React.Suspense>} />
<Route path="/in-between-4" element={<React.Suspense fallback={<>...</>}><TestInfoPage redirectLoc="study-page-5"/></React.Suspense>} />
<Route path="/in-between-5" element={<React.Suspense fallback={<>...</>}><TestInfoPage redirectLoc="study-page-5"/></React.Suspense>} />
<Route path="/study-page-5" element={<React.Suspense fallback={<>...</>}><TestPage redirectLoc={latinSquareOrder[5]}/></React.Suspense>} /> <Route path="/study-page-5" element={<React.Suspense fallback={<>...</>}><TestPage redirectLoc={latinSquareOrder[5]}/></React.Suspense>} />
<Route path="/in-between-5" element={<React.Suspense fallback={<>...</>}><TestInfoPage redirectLoc="study-page-6"/></React.Suspense>} />
<Route path="/in-between-6" element={<React.Suspense fallback={<>...</>}><TestInfoPage redirectLoc="study-page-6"/></React.Suspense>} />
<Route path="/study-page-6" element={<React.Suspense fallback={<>...</>}><TestPage2 redirectLoc={latinSquareOrder[6]}/></React.Suspense>} /> <Route path="/study-page-6" element={<React.Suspense fallback={<>...</>}><TestPage2 redirectLoc={latinSquareOrder[6]}/></React.Suspense>} />
<Route path="/end" element={<React.Suspense fallback={<>...</>}><TestEndPage /></React.Suspense>} /> <Route path="/end" element={<React.Suspense fallback={<>...</>}><TestEndPage /></React.Suspense>} />
<Route path="*" element={<React.Suspense fallback={<>...</>}><NoPageFound /></React.Suspense>} /> <Route path="*" element={<React.Suspense fallback={<>...</>}><NoPageFound /></React.Suspense>} />

Loading…
Cancel
Save