Is there a way to check if a Workperiod is open in GQL

We normally open a workperiod at 7 AM and close it at 9 PM.
Grubhub allows a customer to order, even during closing hours. When that happens, my integration will still try to send a GQL mutation, but the order won’t go through successfully.
Is there a way to check if the workperiod is open via GQL?

SELECT COUNT(*) FROM dbo.WorkPeriods WHERE StartDate = EndDate

If result == 1 there is an open work period

Is there a way via GraphQL?
There doesn’t seem to be a way…
image

Not that I’m aware of.

2020-11-02_10;32_1604334758_chrome 2020-11-02_10;32_1604334766_chrome

I guess I should create a Rule that creates a Global Setting whenever a WP is created and delete that same Setting when a WP is closed?
Are there any potential problems with that?

Not that I can forsee. If it works go for it.

1 Like

Isworkperiodopen is already there in global settings.

3 Likes

I don’t have a Isworkperiodopen Setting, but I do have a WorkPeriodStart Setting, but the value is “0” whether my WP is open or closed.

    {
        "name": "WorkPeriodStart",
        "value": "0"
      }

It’s a local setting. It’s hardcoded.

Sorry it is ISCURRENTWORKPERIODOPEN

I did not give you full setting name. Been a while.

{:ISCURRENTWORKPERIODOPEN}

I’m a little rusty been busy helping US Sambapos grow.

Did I type something wrong? It doesn’t return a value.

Also are Local Settings stored in the database? I don’t see a ISWORKPERIODOPEN setting when I run this in SMSS.

SELECT TOP (1000) [Id]
      ,[Value]
      ,[Name]
  FROM [sqlexpress].[dbo].[ProgramSettingValues]

It’s hardcoded within SambaPOS.

I tried getGlobalSetting and getLocalSetting queries for ISCURRENTWORKPERIODOPEN and get no data:

{
  "data": {
    "getGlobalSetting": {
      "name": "ISCURRENTWORKPERIODOPEN",
      "value": null
    }
  },
  "errors": null
}

.

{
  "data": {
    "getLocalSetting": {
      "name": "ISCURRENTWORKPERIODOPEN",
      "value": null
    }
  },
  "errors": null
}

:confused:

You can update a program setting value at work period started and work period ended event and it would work fine

1 Like