Choose Your Path

Overview

The Automated Ordering Schedule feature allows market administrators to automatically control when customers can place orders. Instead of manually opening and closing your ordering window each week, you can set a recurring schedule that runs automatically.

Perfect for regular market cycles: If your market operates on a predictable weekly schedule (like ordering Monday-Friday and pickup on Saturday), this feature eliminates the manual work of managing your ordering window.

How It Works

  • Set a weekly schedule for when ordering should open and close
  • The system checks every 5 minutes to see if a change is needed
  • When the scheduled time arrives, ordering automatically opens or closes
  • All changes are logged so you can track what happened and when
  • Manual override buttons let you open/close ordering anytime you need

Accessing the Feature

To set up automated ordering schedules:

  1. Log in as a market administrator
  2. Navigate to your market's settings page
  3. Look for the "Automated Ordering Schedule" section
  4. This section appears on the main market settings/edit page
Administrator Access Required: Only market administrators and superusers can configure automated scheduling. Regular growers and customers cannot access this feature.

📲 Try It Yourself (Interactive Demo)

Explore the scheduling interface below! This is the actual component used in your market settings, running in demo mode. All changes are simulated - nothing will be saved.

Interactive Demo Mode

Try out all the features below! Changes won't be saved, so feel free to experiment with different settings.

Your Market's Timezone

How does this work?
Current Market Time: Loading...

All automated opening and closing times will use this timezone. Double-check it's correct for your market location before turning on automated scheduling.

Need to Make a Quick Change?

These manual changes are tracked in your history, separate from automatic changes.

💡 Tip: Try changing the days and times, toggling the schedule on/off, using the manual override buttons, and viewing the change history. Everything works just like the real thing, but won't affect any actual data!

Setting Up Your Schedule

Step 1: Check Your Market's Timezone

Before enabling automated scheduling, it's critical to verify your market's timezone is correct. The automation uses this timezone to determine when to open and close ordering.

Check Current Time

At the top of the scheduling interface, you'll see your market's current time. Verify this matches your local time.

Update Timezone if Needed

If the timezone is incorrect, select the correct one from the dropdown and click "Update Timezone". The system will save your change and reload to show the updated time.

Why This Matters

If your timezone is set to New York but you're actually in California, your ordering window will open and close 3 hours earlier than intended!

Step 2: Turn On Automated Scheduling

Toggle the "Automatically Open and Close Ordering" switch to turn on the feature.

Note: When you first enable scheduling, the system won't make any changes until the next scheduled time arrives. Your current ordering status remains unchanged until then.

Step 3: Configure Your Weekly Schedule

Once enabled, you'll see options to set when ordering opens and closes each week:

Opening Time

  • Open ordering every: Select the day of the week (e.g., Monday)
  • at: Select the time of day (e.g., 9:00 AM) using the time picker

Closing Time

  • Close ordering every: Select the day of the week (e.g., Friday)
  • at: Select the time of day (e.g., 5:00 PM) using the time picker

Example Configurations

Traditional Weekly Market

  • Open: Monday at 9:00 AM
  • Close: Friday at 5:00 PM
  • Use Case: Ordering Monday-Friday, harvest Saturday, pickup Sunday

Weekend Market

  • Open: Sunday at 8:00 PM
  • Close: Thursday at 11:59 PM
  • Use Case: Order Sunday-Thursday, harvest Friday, pickup Saturday

Extended Ordering Window

  • Open: Saturday at 12:00 PM
  • Close: Wednesday at 6:00 PM
  • Use Case: Long ordering period for customers who plan ahead

Step 4: Save Your Settings

Click the "Save Settings" button to activate your automated schedule. You'll see a confirmation message and the next scheduled change will be displayed.

Understanding the Automation

How the System Checks Schedules

The automated ordering scheduler works on these principles:

  • Checks Every 5 Minutes: The system runs every 5 minutes to check if any market needs its ordering window changed
  • 8-Minute Window: When the current time is within 8 minutes after your scheduled time, the change will be triggered
  • Prevents Duplicates: The system only makes the change if the ordering window isn't already in the desired state
  • Timezone Aware: All times are calculated in your market's configured timezone
Why 8 minutes? The system checks every 5 minutes, so to ensure it never misses a scheduled time (even if one check is delayed), it looks for any scheduled change within the past 8 minutes. This provides a safety buffer.

What Happens When the Schedule Runs

When the scheduled time arrives:

  1. The background scheduler detects it's time for a change
  2. A task is queued to open or close ordering for your market
  3. The ordering status is updated in the database
  4. The change is logged with the date, time, and trigger (automated schedule)
  5. Your market's cache is cleared so customers see the change immediately

Coming Up Next

After saving your schedule, you'll see "Coming up:" showing when the next automatic change will occur. This helps you verify your schedule is set up correctly.

Need to Make a Quick Change?

Sometimes you need to override the automatic schedule. The manual override buttons let you immediately open or close ordering, regardless of the schedule.

Using the Override Buttons

Open Ordering Now Button

Immediately opens the ordering window for customers. Use this when:

  • You want to open early for a special event or promotion
  • You need to give customers extra time this week
  • You want to test that everything is working

This button is disabled when ordering is already open.

Close Ordering Now Button

Immediately closes the ordering window. Use this when:

  • You need to close early due to weather or emergencies
  • Growers have sold out and can't fulfill more orders
  • You're making system changes and need to pause ordering

This button is disabled when ordering is already closed.

Good to know: Manual overrides are logged separately from scheduled changes. The automated schedule keeps running in the background, so if you manually close ordering but your schedule says it should be open, the automation will re-open it at the next scheduled time. To prevent this, temporarily disable automation or adjust your schedule.

Temporarily Suspending Automation

If you need to take manual control for a period of time:

  1. Toggle off "Automatically Open and Close Ordering"
  2. Click "Save Settings" to disable automation
  3. Use the manual override buttons to control ordering as needed
  4. When ready to resume automation, toggle it back on and save

Viewing Change History

The system tracks every time your ordering window opens or closes, whether triggered by automation or manual override.

Accessing the History

  1. Click the "View Change History" button at the bottom of the scheduling interface
  2. You'll see the 20 most recent ordering window changes
  3. Each entry shows the action type, date/time, and who/what triggered it

Understanding History Entries

Each history entry includes:

  • Action Badge: Shows whether ordering was opened or closed (color-coded green for open, red for close, orange for manual override)
  • Date and Time: When the action was processed, displayed in your market's timezone
  • Triggered By: Shows "schedule" for automated changes or "manual override" for button clicks
  • Success Status: Indicates if the change completed successfully or encountered an error
  • Error Details: If a change failed, the error message is displayed

Why Review History?

  • Verify your automated schedule is running correctly
  • Troubleshoot if ordering isn't opening/closing when expected
  • Track manual overrides and understand when you made changes
  • Document your market's operational patterns

Troubleshooting

Common Issues and Solutions

Ordering Isn't Opening at the Scheduled Time

Check these items:

  • Verify "Automatically Open and Close Ordering" is turned on
  • Confirm your timezone is set correctly
  • Check the "Coming up:" indicator
  • Review the history for error messages
  • Ensure ordering isn't already open

Schedule Opens/Closes at Wrong Time

Most common cause: Incorrect timezone setting

  • Check your market's current time display
  • Update the timezone if it doesn't match your location
  • Save changes and wait for the next scheduled time
  • Remember: The system uses your market's timezone, not the administrator's local timezone

Manual Override Didn't Work

Possible reasons:

  • Check if you have administrator permissions
  • Verify the button wasn't disabled (already in that state)
  • Look for error messages in the history
  • Try refreshing the page and attempting again

Automated Schedule Keeps Re-Opening After Manual Close

This is expected behavior!

  • The automated schedule continues to run even after manual overrides
  • If the schedule says ordering should be open, it will re-open automatically
  • To prevent this, disable automated scheduling temporarily
  • Or adjust your schedule to match when you want ordering closed

No History Entries Appear

Possible reasons:

  • This is a new setup with no changes yet
  • The schedule hasn't triggered a change yet
  • Wait for the next scheduled time to see an entry
  • Try using a manual override to create a history entry

History Shows Errors

If you see failed changes:

  • Read the error message for specific details
  • Common issues include database or permission problems
  • Contact support if errors persist
  • The system will retry failed changes at the next check cycle

Technical Details for Advanced Users

If you're comfortable with technical details, here's how the system works behind the scenes:

  • Background Worker: A BullMQ worker process runs the scheduling checks every 5 minutes
  • Task Queue: When a change is needed, it's added to a queue for processing
  • Database Updates: Changes update the market table's orderingDisabled field
  • Cache Invalidation: After changes, your market's cache is cleared
  • Logging: All changes are recorded in marketOrderingScheduleLog table

Best Practices

Setting Up for Success

  • Test First: Set up your schedule for a short window (like 15 minutes away) to verify it works before committing to your regular schedule
  • Communicate Changes: Let your growers and customers know about your new automated schedule
  • Monitor Initially: Check the history regularly for the first few weeks to ensure everything runs smoothly
  • Document Your Schedule: Keep a note of your ordering schedule for reference

Ongoing Maintenance

  • Seasonal Adjustments: Update your schedule as your market's needs change with the seasons
  • Holiday Planning: Disable automation or use manual overrides for holiday weeks
  • Regular Review: Check your schedule quarterly to ensure it still meets your needs
  • Update Contact Info: Make sure customers know how to reach you if they have questions about ordering windows

Communicating with Your Community

  • Post your ordering schedule prominently on your market's homepage or footer
  • Include schedule information in welcome emails for new customers
  • Send reminders before the ordering window closes each week
  • Announce any schedule changes well in advance
  • Consider setting expectations (e.g., "Ordering typically opens Monday mornings and closes Friday evenings")

Frequently Asked Questions

Can I have different schedules for different weeks of the month?

No, the current system only supports a single weekly recurring schedule. The same schedule repeats every week. If you need different schedules for different weeks, you'll need to manually update the schedule or use manual overrides.

What happens if I change my schedule in the middle of the week?

The new schedule takes effect immediately. The "Next Scheduled Change" will update to reflect your new settings. If you've already passed a scheduled time for this week, the change won't happen until next week.

Can I schedule multiple opening/closing times per week?

No, you can only set one opening time and one closing time per week. For more complex schedules, you'll need to use manual overrides or adjust the schedule as needed.

Does the system account for daylight saving time?

Yes! Because the system uses your configured timezone (which includes DST rules), it automatically adjusts when daylight saving time begins or ends. Your 9:00 AM opening will always be 9:00 AM local time.

What if I need to skip a week (like for a holiday)?

You have two options: (1) Temporarily disable automated scheduling for that week and manually control ordering, or (2) Use manual overrides to keep ordering closed despite the schedule, then re-enable automation after the holiday.

Can growers see or modify the ordering schedule?

No, only market administrators and superusers can view and modify the automated ordering schedule. Growers can see whether ordering is currently open or closed, but cannot change the schedule.

Will customers be notified when ordering opens or closes?

The automated schedule itself doesn't send notifications. However, customers will see the ordering status change when they visit your market. You may want to set up separate communication (like weekly reminder emails) to let customers know about your ordering schedule.

What happens to orders in progress when ordering closes?

When ordering closes, customers cannot place orders - period. Even if they have items in their cart, they won't be able to complete checkout. The cart page and checkout process will be blocked until ordering reopens. Make sure to communicate your ordering deadline clearly so customers can complete their orders before the window closes.

Need Help with Automated Scheduling?

If you have questions about setting up automated ordering schedules or encounter issues, we're here to help.