Skip to content

Commit

Permalink
Better code quality
Browse files Browse the repository at this point in the history
  • Loading branch information
jesQM committed Apr 24, 2020
1 parent e79c5b8 commit 717117a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/components/podService/podStoreHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export default class PodStorageHandler extends PodHandler{
let routeObject = new MyRoute();
routeObject.modifyFromJsonLd(JSON.parse(content));
forEachRoute(routeObject);
}, (error) => {forEachRoute(null)} );
}, (error) => {forEachRoute(null);} );
}
}.bind(this));
}
Expand All @@ -149,7 +149,7 @@ export default class PodStorageHandler extends PodHandler{
const parser = new N3.Parser();
parser.parse(content, function (error, quad, prefixes) { // parse the content of the message
if (quad) {
if ( quad.predicate.id == "http://schema.org/text" && quad.object.id.includes("/viade/routes/") ) { // If the quad is the url of the route
if ( quad.predicate.id === "http://schema.org/text" && quad.object.id.includes("/viade/routes/") ) { // If the quad is the url of the route
forEachMail(quad.object.id);
this.sharedRoutesToAdd.push(quad.object.id.split("\"").join(""));
}
Expand Down Expand Up @@ -197,7 +197,7 @@ export default class PodStorageHandler extends PodHandler{
file = JSON.parse(file);
} catch (e) {
if (e.status !== 404) {
throw e
throw e;
} else {
file = {
"@context": {
Expand All @@ -209,14 +209,14 @@ export default class PodStorageHandler extends PodHandler{
"viade": "http://arquisoft.github.io/viadeSpec/"
},
"routes": []
}
};
}
}

// 2.- Remove duplicated routes
let alreadyRoutes = file["routes"].map((url) => {return url["@id"]});
let alreadyRoutes = file["routes"].map((url) => {return url["@id"];});
urls.forEach((url) => {
if (alreadyRoutes.indexOf(url) == -1) {
if (alreadyRoutes.indexOf(url) === -1) {
alreadyRoutes.push( url );
}
});
Expand Down
6 changes: 4 additions & 2 deletions src/components/routeList/RouteCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ class RouteCard extends React.Component {
/>
};
this.showShareButton = true;
if (props.showShareButton !== undefined)
if (props.showShareButton !== undefined) {
this.showShareButton = props.showShareButton;
}

this.showInfoButton = true;
if (props.showInfoButton !== undefined)
if (props.showInfoButton !== undefined) {
this.showInfoButton = props.showInfoButton;
}
}

render() {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/RouteSharedList.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default class RouteSharedList extends RouteList {

constructor(props) {
super(props);
if (props.sync == undefined || props.sync == true)
if (props.sync === undefined || props.sync == true)
this.readInbox();
}

Expand All @@ -29,7 +29,7 @@ export default class RouteSharedList extends RouteList {
routesForCardDecks.push(
<CardDeck style={{ padding: "1% 0% 1% 2%", width: "100%" }}>
{this.state.sharedRoutes.slice(counter, counter + this.cardDeckSize).map(
(r) => {return <RouteCard route={r} showShareButton={false} />}
(r) => {return <RouteCard route={r} showShareButton={false} />;}
)}
</CardDeck>
);
Expand Down

0 comments on commit 717117a

Please sign in to comment.