xibosignage / xibo

Xibo Digital Signage
https://xibosignage.com
GNU Affero General Public License v3.0
547 stars 160 forks source link

XMDS: Player has empty scheduled event when a scheduled layout has a draft #3437

Open dasgarner opened 3 weeks ago

dasgarner commented 3 weeks ago

The error is harmless and doesn't impact playback, but the query responsible for returning currently scheduled events could be improved to avoid considering the draft.

In the query we join on layouts via their campaign, and exclude drafts (parentId is null):

         LEFT OUTER JOIN `campaign`
                         ON `schedule`.CampaignID = campaign.CampaignID
         LEFT OUTER JOIN `lkcampaignlayout`
                         ON lkcampaignlayout.CampaignID = campaign.CampaignID
         LEFT OUTER JOIN `layout`
                         ON lkcampaignlayout.LayoutID = layout.LayoutID
                             AND layout.retired = 0
                             AND layout.parentId IS NULL

However, because this is an OUTER join, we do still get the lkcampaignlayout record, including the link to the draft.