Help me to help others

Hello campers,

I have been doing a lot o research but I am still with no answer for what I want to accomplish, it may be obvious but a can’t see it at all.

Problem:

In my town we have 5 pharmacies, every week the pharmacies switch between them so that one can stay open till late and on the weekends.

What I want:

To put together a website that show to anyone, which pharmacy is open on that day. It would be simple, just a calendar made with some HTML and CSS that would show that information forever for anyone.

What I can’t do:

To find which is the best language and a way to do the following in that language.

e.g. The code would have to switch every 7 days(the pharmacies stay 7 days on duty), for 5 times (there are five pharmacies in town), then with would have to start over from the first pharmacy, and so on. It has to be done automatically, even if no one open this page for a moth or so.

Any help, any path would be appreciated.

I am not personally experienced in this but I can point you to the right direction.

I believe the things you described is achievable through cron jobs on Linux, you’ll have to know some linux commands and work with the syntax, but it is a way to execute scripts periodically. shell scripts is what it’s originally for, but you can figure out a way to use it to execute javascript and python as well. You can run it on the server, since most servers are linux based.

However this is not so much a programming solution rather than a software solution.

I hope that is helpful.

1 Like

With no disrespect to @psychometry, I’m pretty confident that some javascript library, or service, exists out there for putting a calendar on a web page, and I bet it’s possible to color the days as well.

The algorithm for deciding how to color each day shouldn’t be very hard either.

I’m confident that a dynamic javascript page can do what the op is asking for.

2 Likes

this is true. Out of the box, Google Calendar is sufficient enough to do what you need as well.

1 Like

This should be possible in any widely-used language, but you could do it all on the front end if you used plain old JavaScript. You’ll need to use Date objects to set up a start date for the cycle and get the current date when the user views the page.

…or use Google calendar or similar if you’re feeling lazy.

This looked like fun, so I gave it a go. Here’s something you can start from, @jmsm16.

You’ll need to add the right logic in the JS colorDays() function so that it starts the proper colors on the proper days.

Clicking the < and > buttons shifts the calendar by one month at a time. Clicking the MONTH YYYY label brings you back to today.

1 Like

Hello again @jmontreal , sorry for take so long to answer, but look at what I have done.

That is what I wanted to do, it is going to show the pharmacy on duty that week for anyone. When I wrote this post I was at the very beginning with js (still am), and had no idea what to do to solve my problem. What I was really looking for was how to properly use the module operator (just now I realize that), more a math problem than with the language itself.

Thanks for everyone help, And If you have something to say to improve my code, make your self at home.