Weekly shift schedule

Hello, good day! I am working on a weekly shift system, where before loading I make a prior consultation to find out if the shift is available or not. I'm having problems because I save the data correctly, the problem is that I can't make the comparison.
I accept all kinds of recommendations, change database work in another way, whatever.
BD: fire base
Lists are preloaded, visually it looks like this:

The blocks are similar to this (ignore some mistakes) I'm still learning with the app :

Hello,
In order that more users can help you, I recommend that you temporarily change the language to English, to take the screenshot.

Also explain what storage you are using, and your data schema, and explain in detail what problem you are encountering.

Okay, I will do it as soon as I can

I created another tab to see if I can get help in English


Blocks


What it manages to save


Here's what I'm trying to compare. Check


Saves

Everything is fine until I try to compare again and can't get it to compare the existing shift with the shift that's already been saved. If they can help me with what I want to accomplish, or if there's another way I can save weekly shifts and then compare it.

Instead of nested lists, which are giving you problems, I would switch to a concatenated key structure, with unique keys under branch clinic/SHIFT of the form
ClinicName-Day-HHmm-TypeOfCare
and values of either true/false or staffer name to show coverage.

This has the advantage of

  • no list maintenance needed
  • unique shift IDs
  • atomic update
  • entire shift collection would be returned as a dictionary if you request clinic/SHIFT from Firebase.

I understand your logic, but not knowing the software that much, it's complicated for me. Could you try to explain me with examples please?
If possible, an .aia file to understand it better. I'm super grateful for your answer, I think that will fix my app's problem.

Here is a sample app.
I did not add any code to filter the Firebase result value in any way.
image


weekly_shifts.aia (4.2 KB)

2 Likes

Ok, I'm grateful for your help. I'll try to translate it into my work, if I have any problems I'll reply to the post. You're a genius.

Everything is going very well, but I am still in the same place, when I save an equal data, it replaces it. My goal is for it to detect that that element or in this case the tag exists, and inform me that the shift I am trying to add already exists at that time. It should be remembered that the shifts will be erected by the users and if that data already exists, the user should be notified with a notification.

In this version I added a filter to match the Spinner Selections in the ListView, so the Elements list will have a length of 1if a replacement will happen. It would be hard to miss that the chosen tag exists from that.


weekly_shifts.aia (6.5 KB)

Unfiltered:
image

Clinic filter:
image

Type of Care filter:
image

The same thing still happens, when I try to save a value in the same clinic, day, time and same query I would like it not to be able to be assigned because that label already exists. My idea is basic but I would like it to be something like "If that label exists", in the case that if there is a message saying, "there is already a shift at that time, try to assign another time or day" and in the case that the shift is not repeated, save it. I repeat, the application is for the client, not for the doctor.

That's an entirely different game.

The concept of a shift schedule is for administrators of a business, to set up policy for where and when doctors should show up to do business.

Are you trying to turn this into a patient scheduling app?

I realized that it was for administrator, so I clarified that it was for patients. Exactly, they are shifts for patients. To save hours of lines and waiting. Could you help me in that case? I thank you with all my heart for the time you take to help me.

To simplify login of administrators versus patients, I suggest a splash Button at startup, with Click leading to setting up for patient read-only access, and a Long Click leading to asking for admin login.

Admin login would be a low security password request from Firebase Bucket ADMIN tag Password.

After login succeeds, expose an option to change the admin password (optional).

Leave admin status (true/false) in a global variable for use at browse time.

If admin is false, don't show the Horizontal Arrangement for updating the shifts.

Is that okay with you?

Here's an implementation of admin login.
I leave it to you to add password maintenance.
Default admin password is 'admin'.
image


weekly_shifts.aia (8.2 KB)

Sorry, I think it's not what I was looking for, my goal is for the patient to choose the shift, not the administrator. I already have the login section. I only need one sector where the patient chooses his turn and does not get in the way of another at the time of requesting it.

That sounds like a list hanging off the shift tag, with the date as a subkey. To avoid patient login you could mimic one of those numbered ticket dispensers they have at the deli counter, where the patient can take the next number, and the receptionist calls the next number.

You might need a receptionist login.

Think about it.

Your idea is very good, but it's not what I'm looking for. Regardless of the login, the labels you would like to achieve are: Shifts -> clinic - day - time.
The only thing I am not achieving is that when pressing the "save" button, the patient identifies if that shift is saved or not. For example a "check" button was my main idea, if there is that shift to launch an alert "it already exists choose another time or day", but with mit app inventor and firebase I could not achieve it. I think I'm getting complicated, maybe you have a more simplified idea or another method that can help me. I'm a little frustrated because I'm missing only that :frowning:

On its way into the ListView but before the filter blocks, save the dictionary that arrives from Firebase into a global variable.

Its keys (use the dictionary keys block) are a list of what has already been saved.

So you can use the is_in_list block to check the existence.

You would have to join the 4 picker selections with '-' between them to get the item you want.

I suspect I am giving the right advice for the wrong problem.

Going back to the benefit to the app user,
How would this app help its users?
What data do they need to feed it to let it do its job?
How long should the app keep that data?