Skip to content

Commit

Permalink
Merge branch 'uat_issue66' of https://github.com/bahnzumberg/zuugle-s…
Browse files Browse the repository at this point in the history
…uchseite into uat_issue66
  • Loading branch information
martinheppner committed Feb 29, 2024
2 parents 81b3f75 + f74a91e commit d1a3d91
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 31 deletions.
9 changes: 4 additions & 5 deletions src/actions/tourActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
} from "./types";
import { loadFile, loadList, loadOne, loadOneReturnAll } from "./crudActions";
import i18next from "i18next";
import { consoleLog } from "../utils/globals";

export function loadTours(data = {}) {
const language = i18next.resolvedLanguage;
Expand Down Expand Up @@ -108,12 +109,10 @@ export function loadTourConnections(data) {
data.domain = window.location.host;
let returndataPromise = loadList(dispatch, getState, LOAD_TOUR_CONNECTIONS, LOAD_TOUR_CONNECTIONS_DONE, "tours", data, "tours/" + data.id + "/connections", "connections", false, undefined, language);

console.log("data.id: ");
console.log(data.id);


returndataPromise.then(returndata => {
console.log("returned data: ");
console.log(returndata);
consoleLog("L114 tourActions/loadTourConnections -> data: ", data);
consoleLog("L115 tourActions / loadTourConnections / returned data: ", returndata);
});

return returndataPromise;
Expand Down
4 changes: 3 additions & 1 deletion src/components/DomainMenu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";

function DomainMenu() {

let host = location.href;
let host = window.location.href;

let listOfDomains = [];
let domain = 'www.zuugle.at';
Expand Down Expand Up @@ -199,6 +199,7 @@ const secondMenu = [
src={`/app_static/img/logo-white.png`}
height={"19px"}
width={"34px"}
alt="logo white"
/>
<Typography
style={{
Expand Down Expand Up @@ -232,6 +233,7 @@ const secondMenu = [
src={`/app_static/img/logo30.png`}
height={"19px"}
width={"34px"}
alt="logo30"
onClick={() => {
setShowDomainMenu(false);
window.location.replace(item.url);
Expand Down
46 changes: 24 additions & 22 deletions src/utils/transformJson.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,39 +75,41 @@ export default function transformToDescriptionDetail(descriptionJSON) {

return descriptionDetail;
}
// if(Array.isArray(descriptionJSON) && descriptionJSON.length > 0){

export function jsonToStringArray(connection, toFrom = "to"){
// consoleLog("L1 : connection : ",connection), get connection as an object
// toFrom is "to" or "from" , to use the right text in end or begining of array
// this is done by using either "totour_track_duration" or "fromtour_track_duration"

let stringArray = [];
let descriptionJSON = toFrom === "to" ?
connection.connection_description_json
:
connection.return_description_json;
if(!!connection && !!connection.connection_description_json && !!connection.return_description_json )

for (let i = 0; i < descriptionJSON.length; i++) {
const connection = descriptionJSON[i];
const connectionType = getConnectionTypeString(connection.CT);
{ let descriptionJSON = toFrom === "to" ?
connection.connection_description_json
:
connection.return_description_json;

if (connection.T === "D") {
stringArray.push(`${connection.DT} ${connection.DS}`);
} else if (connection.T === "C") {
stringArray.push(` | ${connection.CD} Std mit ${connectionType} ${connection.CN} nach`);
} else if (connection.T === "T") {
// totalTransferTime += getMinutesFromDuration(duration);
stringArray.push(` = ${connection.TD} Std Umstiegszeit`);
} else if (connection.T === "A") {
stringArray.push(`${connection.AT} ${connection.AS}`);
for (let i = 0; i < descriptionJSON.length; i++) {
const connection = descriptionJSON[i];
const connectionType = getConnectionTypeString(connection.CT);

if (connection.T === "D") {
stringArray.push(`${connection.DT} ${connection.DS}`);
} else if (connection.T === "C") {
stringArray.push(` | ${connection.CD} Std mit ${connectionType} ${connection.CN} nach`);
} else if (connection.T === "T") {
// totalTransferTime += getMinutesFromDuration(duration);
stringArray.push(` = ${connection.TD} Std Umstiegszeit`);
} else if (connection.T === "A") {
stringArray.push(`${connection.AT} ${connection.AS}`);
}
}
}

if(toFrom === "from"){
stringArray.unshift(` < ${formatToHHMM(connection.fromtour_track_duration)} Std Rückstiegsdauer vom Touren-Endpunkt`)
}else if(toFrom === "to"){
stringArray.push(` > ${formatToHHMM(connection.fromtour_track_duration)} Std Zustiegsdauer zum Touren-Ausgangspunkt`)
if(toFrom === "from"){
stringArray.unshift(` < ${formatToHHMM(connection.fromtour_track_duration)} Std Rückstiegsdauer vom Touren-Endpunkt`) // for translation create seperate variables out of ${formatToHHMM(connection.fromtour_track_duration)}
}else if(toFrom === "to"){
stringArray.push(` > ${formatToHHMM(connection.totour_track_duration)} Std Zustiegsdauer zum Touren-Ausgangspunkt`) // for translation create seperate variables out of ${formatToHHMM(connection.totour_track_duration)}
}
}

return stringArray;
Expand Down
2 changes: 1 addition & 1 deletion src/views/Main/DetailReworked.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ useEffect(() => {
// !!res.data.result && console.log("L333 res.data.result :",res.data.result);
// !!res.data.result && !!res.data.result[0] && console.log("L334 res.data.result :",res.data.result[0]);
if(!!res.data.result && !!res.data.result[0] && !!res.data.result[0].connections && res.data.result[0].connections[0].connection_description_json) {
let connectJson = res.data.result[0].connections[0].connection_description_json;
let connectJson = !!res.data.result[0].connections[0].connection_description_json && res.data.result[0].connections[0].connection_description_json;
console.log("L338 connections -> connectJson:",connectJson);
let textDescription = Array.isArray(connectJson) && transformToDescriptionDetail(connectJson);
console.log("L340 text connections -> connectJson:");
Expand Down
8 changes: 6 additions & 2 deletions src/views/Main/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ try {
const [counter, setCounter] = useState(null);


const currentParams = new URLSearchParams(location.search);
const handleArrowClick = () => {
const currentParams = new URLSearchParams(searchParams.toString());
currentParams.delete('range');
navigate({ search: `?${currentParams.toString()}` });
};

let filterCountLocal = !!localStorage.getItem("filterCount") ? localStorage.getItem("filterCount") : null;
let filterValuesLocal = !!localStorage.getItem("filterValues") ? localStorage.getItem("filterValues") : null;
Expand Down Expand Up @@ -248,9 +252,9 @@ try {
<Link
to={{
pathname: "/",
search: currentParams.toString(),
}}
replace
onClick={handleArrowClick}
>
<ArrowBefore
style={{ stroke: "#fff", width: "34px", height: "34px" }}
Expand Down
1 change: 1 addition & 0 deletions src/views/Start/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export default function Header({
src={`/app_static/img/logo-white.png`}
height={"16px"}
width={"29px"}
alt="logo"
/>
<Typography
style={{
Expand Down

0 comments on commit d1a3d91

Please sign in to comment.