Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataLovers POKENDIA GO! #37

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,17 @@ y de equipo.

### UX

- [ ] Diseñar la aplicación pensando y entendiendo al usuario.
- [ ] Crear prototipos para obtener _feedback_ e iterar.
- [ ] Aplicar los principios de diseño visual (contraste, alineación, jerarquía).
- [x ] Diseñar la aplicación pensando y entendiendo al usuario.
- [x] Crear prototipos para obtener _feedback_ e iterar.
- [x] Aplicar los principios de diseño visual (contraste, alineación, jerarquía).
- [ ] Planear y ejecutar _tests_ de usabilidad.

### HTML y CSS

- [ ] Entender y reconocer por qué es importante el HTML semántico.
- [ ] Identificar y entender tipos de selectores en CSS.
- [x] Identificar y entender tipos de selectores en CSS.
- [ ] Entender como funciona `flexbox` en CSS.
- [ ] Construir tu aplicación respetando el diseño planeado (maquetación).
- [x] Construir tu aplicación respetando el diseño planeado (maquetación).

### DOM

Expand All @@ -110,8 +110,8 @@ y de equipo.

- [ ] Manipular arrays (`filter` | `map` | `sort` | `reduce`).
- [ ] Manipular objects (key | value).
- [ ] Entender el uso de condicionales (`if-else` | `switch`).
- [ ] Entender el uso de bucles (`for` | `forEach`).
- [x] Entender el uso de condicionales (`if-else` | `switch`).
- [x] Entender el uso de bucles (`for` | `forEach`).
- [ ] Entender la diferencia entre expression y statements.
- [ ] Utilizar funciones (parámetros | argumentos | valor de retorno).
- [ ] Entender la diferencia entre tipos de datos atómicos y estructurados.
Expand All @@ -121,9 +121,9 @@ y de equipo.
- [ ] Testear funciones (funciones puras).

### Git y GitHub
- [ ] Ejecutar comandos de git (`add` | `commit` | `pull` | `status` | `push`).
- [ ] Utilizar los repositorios de GitHub (`clone` | `fork` | gh-pages).
- [ ] Colaborar en Github (pull requests).
- [x] Ejecutar comandos de git (`add` | `commit` | `pull` | `status` | `push`).
- [x] Utilizar los repositorios de GitHub (`clone` | `fork` | gh-pages).
- [x] Colaborar en Github (pull requests).

### Buenas prácticas de desarrollo
- [ ] Organizar y dividir el código en módulos (Modularización).
Expand Down
69 changes: 57 additions & 12 deletions src/data.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,58 @@
// import data from './data/injuries/injuries.js';
// import data from './data/lol/lol.js';
// import data from './data/patient/patient.js';
// import data from './data/pokemon/pokemon.js';
// import data from './data/rickandmorty/rickandmorty.js';
// import data from './data/steam/steam.js';
// import data from './data/steam/worldbank.js';

// esta es una función de ejemplo

export const example = () => {
return 'example';
//Ordenado
const sortData = (data, sortBy, sortOrder) => {
let arrOrdPok = []; //Array Ordenar Pokemones

/* Orden Alfabetico descendente y ascendente */
if (sortBy === 'name') {
if (sortOrder === 'A-Z') {
arrOrdPok = data.sort(function(abc, bcd) {
if (abc.name > bcd.name) return 1;
if (abc.name === bcd.name) return 0;
return -1;
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Pregunta, a qué se refieren los parámetros abc, bcd? Me parece que podrían tener nombres más descriptivos :)


} else {
arrOrdPok = data.sort(function(abc, bcd) {
if (bcd.name > abc.name) return 1;
if (bcd.name === abc.name) return 0;
return -1;
});
}

/* Orden por ID */
} else if (sortBy === 'number') {
if (sortOrder === 'asc') {
arrOrder = data.sort(function(abc, bcd) {
if (abc.id > bcd.id) return 1;
if (abc.id === bcd.id) return 0;
return -1;
});
} else {
arrOrdPok = data.sort(function(abc, bcd) {
if (bcd.id > abc.id) return 1;
if (bcd.id === abc.id) return 0;
return -1;
});
}
}
return arrOrdPok;
};

//Filtrado
const filterData = (data, condition) => {
let arrType = [];
for (let i = 0; i < data.length; i++) {
for (let x = 0; x < data[i].type.length; x++) {
if (data[i].type[x] === condition) {
arrType.push(data[i]);
}
}
}
return arrType;
};

window.poke= {
sortData,
filterData
};

Copy link
Contributor

Choose a reason for hiding this comment

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

Muy buen trabajo!

2 changes: 0 additions & 2 deletions src/data/injuries/injuries.js

This file was deleted.

1 change: 0 additions & 1 deletion src/data/injuries/injuries.json

This file was deleted.

Loading