Skip to content

Ejercicio metro L.A#71

Open
codemcu wants to merge 2 commits intomasterfrom
dev-mau-metro
Open

Ejercicio metro L.A#71
codemcu wants to merge 2 commits intomasterfrom
dev-mau-metro

Conversation

@codemcu
Copy link
Copy Markdown
Collaborator

@codemcu codemcu commented Jan 28, 2019

Ejercicio metro L.A

@codemcu codemcu mentioned this pull request Jan 28, 2019
46 tasks
Copy link
Copy Markdown
Contributor

@UlisesGascon UlisesGascon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codemcu se nota como vas asentando asincronía y te vas alejando de Angular. Muy bien enfocado, pequeños detalles que cambiar... pero en general muuuy bien! 😍

});
}

init(URL);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No es un mal patrón definir una inicialización como init 👍

const markers = coordinates.map(function (location, i) {
return new google.maps.Marker({
position: location,
label: labels[i % labels.length]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sería más interesante tirar de información del propio medio de transporte... lat, lon, etc...

initMap(coordinates);
}

function initMap(coordinates) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bien enfocado! Me gusta que juntes las funcionalidades bajo nombres tan claros! 👍


function getAllRoutes(vehicles) {
let vehiclesConcat = [];
vehiclesConcat = Array.prototype.concat.apply([], vehicles);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

podrias dejarlo en una linea! y además tirar de array.from()

return replaced;
}

async function getAllVehicles(arrayUrlsParsed) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dale una vuelta a esta función... por un lado mezclas mucho async/await para luego devolver un promise.All que podrías haber gestionado muy distinto. Pero muy muy buen enfoque.

}

function searchAndReplaceNumberVehicle(arrayIds, URL_ROUTE) {
let replaced = [];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esto necesita un map y no un forEach... y lo sabes!

y-lo-sabes

}

function getIds(resRoutes) {
const array = resRoutes.items;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puedes hacer el return directamente!

document.querySelector('#spinner').style.display = 'none';
} else {
document.querySelector('#spinner').style.display = 'none';
document.querySelector('#map').innerHTML = '<p style="position: absolute; transform: translate(-50%, -50%); top: 50%; left: 50%;">Algo ha ido mal, vuelve a intentarlo mas tarde</p>';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Casi mejor tener un div oculto por defecto con este mensaje y mostrarlo cuando el map no funcione

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants