Tl;dr I am a mediocre developer and realized I had some strange logic in the website. I think I corrected it. This post talks about what I did poorly, and how I (think I) corrected the issue.
The build is based on Jekyll and Liquid. The structure was forked from DataSaturdays and some great work from Rob Sewell there. Since then, I modified the site in different ways, which give a lot of flexibility to organizers.
Controlling the Site
If you look at the file, there are a lot of entries in there. A quick text view of the speaker section is shown below:
speakertext: The call for speakers is now closed. speakerlisturl: submittedsessionurl: https://sessionize.com/api/v2/rfkt8xee/view/Sessions callforspeakersurl: https://sessionize.com/sqlsatjax1041 callforspeakers: false callforspeakersenddate: 31 Mar 2023
These values are then applied in a layout view and replace certain structures. For example, in controlling the CFS, we have this code. Note I’ve removed the liquid markers to prevent issues.
Here we are logically looking at the speakerlisturl key. It’s blank in the YAML above, so this code block wouldn’t output anything on the page. If it weren’t blank, the value would be added to the script tag and get the data from Sessionize.
My logic had a problem. It was reusing a value to do a couple of different things. I think I had a three-phase logic section (or maybe four?) in there. I had this layout code. Note that I’m checking for a true/false value to display the CFS. I then display the date.
if pagedata.callforspeakers == false The call for speakers is not open. else You can submit a session by clicking the link below. The call for speakers ends on --pagedata.callforspeakersenddate-- </p> [[button url using pagedata.callforspeakersurl]] if pagedata.submittedsessionurl -- list sessions endif endif
The problem is the date is what really matters. The true/false value was added because a few events didn’t want a public CFS. That’s OK, but I then have the date displayed, but not checked. The date really determines if the CFS is open.
I’m really using the callforspeakers to decide if there is a CFS and if it is open.
Fixing the Issue
I decided to separate out the logic here and have one thing mean one thing. My decision:
- The callforspeakers determines if there is a CFS or not.
- the callforspeakersenddate determines if the CFS is open or not
To implement this logic, I changed to code to this:
if pagedata.callforspeakers == false There is no call for speakers. else
The else part of this will now determine if the CFS is open or not. The key, callforspeakers, not just determines if the event has a CFS.
The else part really does this. I’m showing part of the code, but essentially I’m showing the button for submissions if the CFS close date hasn’t passed. I’ve added comments for psuedocode after the hash marks.
if pagedata.callforspeakersurl if pagedata.callforspeakersenddate > now ## Show buttons else The call for speakers is closed. endif else The call for speakers is not open. endif
With this logic, if there is no CFS URL, the CFS isn’t open. Once I get this from the organizer, I add it to the YAML (or they do).
If there is a CFS, then I check the date. If the date is not past, we show the button, otherwise, we show a closed note.
There is other logic to display submitted sessions or other info on the site, but that’s the basics of the logic.
Hopefully this gives organizers some flexibility. Only a couple events have bothered with showing submitted sessions. Most have a CFS, but not all. I’m trying to be flexible here with lots of switches that allow organizers to customize their events.
We appreciate your support of SQL Saturday. If you or others want to join our mailing list, you can register here: http://eepurl.com/hwVBKn. Please feel free to pass this along to others.