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

Status check and reminders #134

Open
skjerns opened this issue Jan 6, 2021 · 5 comments
Open

Status check and reminders #134

skjerns opened this issue Jan 6, 2021 · 5 comments

Comments

@skjerns
Copy link
Member

skjerns commented Jan 6, 2021

As a rather larger update I want to discuss embedding

  1. status check
  • check congruency between WC and couchdb - in principle this should have no problems anymore, but would be good to be safe
  • I think this would go well with the notifications-tab that you mentioned. Generally I like the idea of having some sort if "issue"-tab, where problems get logged and can be fixed, additionally we could also allow custom to-dos here, e.g. "customer forgot his passport"
  1. email reminders
  • for delayed returnd
  • for customer deletion after 2 years
  • mails could be either sent from within the framework, or just create mailto-links.

I think you once mentioned that you still would want to do this via the python CLI, am I correct? is there a reason for not doing this in the web app (besides it being a bit cumbersome to connect to IMAP/SMTP)?

Currently the python-script still relies on the excel, but I guess that could be changed easily

@daniel17903
Copy link
Contributor

These are good ideas but I think we should implement both of them in separate (python or anything else) scripts because

  • Those are quite long running / expensive tasks that would slow down the UI
  • There might be several instances of the Frontend running in parallel (on different devices) which might lead to sending mails or creating notifications multiple times
  • Could only run while the Frontend is opened (we could not send mails every day)
  • I prefer modularization to keep the code easier to understand and more flexible. If we want to remove WC at some point in the future we could just remove the script.
  • Since those scripts could also access CouchDb, generated notifications or info about sent mails could easily be shown in the Frontend.

@skjerns
Copy link
Member Author

skjerns commented Jan 19, 2021

I altered the old script and implemented the congruency check https://github.com/leih-lokal/scripts/blob/master/leihlokal.py

I'll add the email reminders tomorrow.

One question: We now have three different points where a status is saved

  1. status on WC
  2. status_on_website of item in couchdb
  3. query: is there a non-returned rental active with the item?

Are 1) and 2) somehow updating each other automatically? Or only 2->1? Could we think about just getting rid of the flag 2) and getting the status from WC or by query?

@daniel17903
Copy link
Contributor

Ok great.

We only update from 2 -> 1 because the idea was that we would edit everything from the new system and not in wordpress anymore. Also, automatically updating 1 -> 2 would require us to detect changes on WC automatically which we could only do by sending a lot of HTTP Requests all the time.

I think we should not get rid of 2. because loading the status from WC everytime is very slow. Also we could not filter or search by status anymore (would take several minutes to load all states from wc).

I don't understand the 3. point. We don't save another state in rental. A rental only has a rented_on and returned_on date. If the rental is active the returned_on date is 0.

@daniel17903
Copy link
Contributor

Of course we could implement a script to find items for which there are different status in wc and couchdb. But then the script could not automatically change the state because it does not know which state is correct. It could only notify the user. I think your script already does that?

@skjerns
Copy link
Member Author

skjerns commented Jan 20, 2021

I don't understand the 3. point. We don't save another state in rental. A rental only has a rented_on and returned_on date. If the rental is active the returned_on date is 0.

We can see which rentals have not been returned, and that gives a good indication whether the item is available or not (unless its a hammer, of which we have several)

So, the item can be currently rented by someone (3), but item.status_on_website shows "available", and WC shows "unavailable". But I see, it might not be possible otherwise.

for now I only check the status on the website, and whether the item is rented by someone at this point.

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

No branches or pull requests

2 participants