-
Notifications
You must be signed in to change notification settings - Fork 0
Add persistence in local storage with SQLite #8
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
Conversation
app/src/main/java/com/example/ticketscan/domain/repositories/ticketitem/TicketItemRepository.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/example/ticketscan/domain/viewmodel/RepositoryViewModel.kt
Show resolved
Hide resolved
app/src/main/java/com/example/ticketscan/domain/repositories/store/StoreRepository.kt
Show resolved
Hide resolved
app/src/main/java/com/example/ticketscan/domain/repositories/ticket/TicketRepositorySQLite.kt
Show resolved
Hide resolved
| val minDate = dateFormat.format(now.time) | ||
|
|
||
| val cursor = db.rawQuery( | ||
| "SELECT ti.category_id, SUM(ti.price * ti.quantity) as total, c.color FROM ticket_items ti " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originalmente pensé que el precio sea independiente de la cantidad, o sea que estaría mal multiplicarlo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guarda Pato que en ticket_items se guarda cantidad y precio unitario. En stats se guarda el sumarizado, normalizado para simplificar. Si no te referis a eso, lo fixeo en otro pr. Asi no sigo bloqueando con esto
| ); | ||
| """) | ||
| } | ||
| override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No termino de entender esto, para qué se usaría? Igual es una duda, dejo el approve y por mi mergealo así avanzamos que nos bloquea un poco esto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Es un método que se ejecuta al cambiar de versión de la db. Elimina la tabla y la vuelve a crear. No lo vamos a usar igual
No description provided.