A
A
Anrek2021-11-03 19:35:20
Android
Anrek, 2021-11-03 19:35:20

How to organize the storage of data that the product has been viewed?

Good afternoon!

Given: there is a list loaded from the database, it contains a list of goods. You can click on a product to view it in more detail. Then 1 more request is sent to the server and I get data about this product.

Task: if I have already visited to view the product "detailed" - mark it as "viewed". And for this session and for all subsequent ones.

Question: how to organize data storage?

I think like this: it's
kind of simple to create a viewedMe table in the db with columns: userid and productid . When subloading list, I just get 1 more Bolean variable and that's it.

but here are the problems that pop up at the 2nd step of using:

1) I go to "details" - I send a request so that the value "true" is saved in the database. Everything is OK

2) I go back to the list to continue browsing and then 2 options:
- I use the sheet already loaded from the database and then I cannot mark the solution as "viewed"
- I recreate the list with requests to the server, update the information. Problem: what if I was at position 1000? is it all 1000 reloaded into the tape? In default mode, I only load them in 5 pieces.

Both solutions are not suitable. What to do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anrek, 2022-03-05
@Anrek

I decided this way:
-I did not use the global storage for information about the pages viewed, but the local one on the client. The solution is not ideal, but the customer was satisfied.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question