Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Integracão reserva api #9

Merged
merged 11 commits into from
Jul 19, 2017
Merged

Integracão reserva api #9

merged 11 commits into from
Jul 19, 2017

Conversation

ericbreno
Copy link
Collaborator

No description provided.

posSalvar(data);
return self.reserva.salvar().then(data => {
AgendamentoService.salvarReserva(self.reserva);
posSalvar();
Copy link
Owner

Choose a reason for hiding this comment

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

Toaster para notificar sucesso

@@ -39,38 +41,57 @@ let sequenceReserva = 1;
corTexto});
}

function obterPropriedades(instancia, props) {
Copy link
Owner

Choose a reason for hiding this comment

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

JSDoc

if (indiceReserva !== -1) {
// atualizar
mock.splice(indiceReserva, 1, new Reserva(reserva));
reservas.splice(indiceReserva, 1, new Reserva(reserva));
Copy link
Owner

Choose a reason for hiding this comment

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

Testa se isso anida funciona

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Realmente precisa, documentei como funciona.

*/
function getIndiceReserva(lista, reserva) {
function getIndiceReserva(lista, id) {
for (let i = 0; i < lista.length; i++) {
Copy link
Owner

Choose a reason for hiding this comment

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

});

return promiseEventosFuturos.then(reservasRes => {
let reservasDia = reservasRes.filter(r => r.dia === data);
Copy link
Owner

Choose a reason for hiding this comment

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

const

@@ -110,79 +80,26 @@
* @return {Promise} Promessa contendo a reserva.
*/
this.getReserva = id => {
let indiceReserva = getIndiceReserva(mock, {id});
return $q.when(mock[indiceReserva]);
let indiceReserva = getIndiceReserva(reservas, id);
Copy link
Owner

Choose a reason for hiding this comment

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

const

let indiceReserva = getIndiceReserva(mock, {id});
return $q.when(mock[indiceReserva]);
let indiceReserva = getIndiceReserva(reservas, id);
return $q.when(reservas[indiceReserva]);
Copy link
Owner

Choose a reason for hiding this comment

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

Precisa de promise?

Copy link
Collaborator

@velmer velmer Jul 19, 2017

Choose a reason for hiding this comment

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

Precisa da promise? ficou em aberto do último review

if (r._id.toString() === reserva._id) {
continue;
}
if (r.fim > inicio && r.inicio < inicio
Copy link
Owner

Choose a reason for hiding this comment

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

Extrair condição para função

Repository owner deleted a comment from estacioneto Jul 19, 2017
const caso2 = inicio < r.fim && fim > r.fim;
const caso3 = inicio >= r.inicio && fim <= r.fim;
const caso4 = inicio <= r.inicio && fim >= r.fim;
if (caso1 || caso2 || caso3 || caso4) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Dá uma olhada nesses casos que eu tinha montado, creio que dá pra cobrir todos apenas com 3 condições. Seria bacana extrair para um método: causaChoqueDeHorario(reserva), por exemplo

let indiceReserva = getIndiceReserva(mock, {id});
return $q.when(mock[indiceReserva]);
let indiceReserva = getIndiceReserva(reservas, id);
return $q.when(reservas[indiceReserva]);
Copy link
Collaborator

@velmer velmer Jul 19, 2017

Choose a reason for hiding this comment

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

Precisa da promise? ficou em aberto do último review

@ericbreno ericbreno merged commit a5ec165 into master Jul 19, 2017
@ericbreno ericbreno deleted the integraca-reserva-api branch July 19, 2017 23:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants