2025.03.19 aka Sort It Out
Bmore Today is almost ready for release! This morning's focus: price sorting and user settings.
Unknown vs Not Provided
First thing I tackled today was small. For some reason, when I wrote the script for BaltShowPlace, I decided Unknown
would be the fallback price if no price was detected. But all other source defaults to Not Provided
. So, I just unified that.All sources now default to Not Provided
if a price isn't matched.
free/Free/FREE
Another small fix. In Baltimore Mag, if a price had Free
, I was converting it to 0
. In today's batch, a FREE
snuck through. So instead of replacing on Free
, I added a case-insensitive regex to make it more robust and anticipatory.
Zero to Infinity
This was the first big task of the day. Now that I've added minPrice
and maxPrice
, I wanted to add a sort by price option to the sorting options in the sidebar. It wasn't quite right in the beginning, the sorting was inconsistent. But then, I implemented my original plan when I added the columns to the SQL table. SQL doesn't support Infinity
but TS definitely does. So, in the event that minPrice
or maxPrice
doesn't exist, they're set to Infinity
. Sorting is then comparing minPrice
s first, if they're the same, compare maxPrice
s.
Choices, Choices, Choices
The last major thing I wanted to tackle was storing user preferences. Before, a user could visit the page, set either temperature or time formatting preferences. Those preferences would go into effect, but they wouldn't persist; a sort refresh would reset them. So, I updated the Preference Context to save them to and retrieve them from localstorage.
At that point, I thought "Hmm, why not apply this to filters and sort as well?" That way, their last filters and sort are retained for the next time they visit.
Final Thoughts
Today felt like the final stretch. There are still things I have planned (integrating BmoreArt, maybe Meetup and Eventbrite as well), but in the meantime, I have four sources, various persistent user settings, and a decent looking site if I do say so myself. Just want to double check the breakpoints and then I'll feel comfortable sharing it.
Bonus
Besides Bmore Today, I started working on JOAT (maybe like Sunday or Monday), but haven't been writing debriefs afterwards. 1) whenever I've been working on it, it's been late at night so I just want to go to sleep and 2) I need a cohesive enough UI/UX worked out in my head before feeling like "Ok, I have a solid grasp on the direction I want to go in". But last night, I wrote a script to compile a dataset of active subreddits from Reddit's "best" communities. Not exactly sure why Reddit doesn't have an endpoint for all subreddits, but this page is a nice alternative. I let it run overnight and woke up to successfully retrieving 342,444 subreddits. I still need to save them to a database, but I think my next step is exploring vectorizing each subreddit name so that I can do a semantic search against the hobbies so that each hobby has maybe three to five subreddits attached as a jumping off point.