So, I’m making an app that shows crochet instructions step-by-step. You can play with the app here or see a quick walkthrough here.
Essential features of the app are:
- Show instructions step-by-step
- Keep track of the progress by marking completed steps with a checkmark
All of this is working in the current prototype, but it’s a little “dumb and dirty.” A bunch is going on to enable “Next/Previous” functionality, which I was figuring out here.
Currently, all step-by-step instructions are written row-by-row literally. So each step of the instruction takes a row in a sheet. This is pretty straightforward but inefficient because many patterns require row repeats. Some of them, many, many, row repeats. And if we’re talking about paired items (for example, socks), you have to repeat the whole pattern twice. Not only does it take up many unnecessary rows of data, but it also makes it hard and inefficient to make changes to patterns. I have to remember all the repeat rows I have for each pattern and update the info in each of those rows. That’s obviously not ideal.
While working on adding sizing feature here, I discovered the Miracle method and had an idea. Instead of writing out all instructions row-by-row, including repeats, what if I had an array of unique row ids stored with my pattern, transpose it using the Miracle method, and only kept unique row instructions in the pattern_instructions
table?
I made a quick prototype of my thinking here, and it works great for loading the correct instructions:
It most certainly saves me some rows in the pattern_instructions
table, even though the row_ids_transposed
table will have to be relatively large to accommodate various patterns that can get pretty long. Still, the savings in core tables are so significant that I’m willing to put up with this.
And although loading instructions works great, I lost the ability to save the user’s progress with the boolean column. So,
I’m looking for suggestions on saving users’ progress through the pattern.
Because the row_ids_transposed
table is dynamic, its contents depend on user actions. And although each user can only be viewing one pattern at a time (which is why I think this method will work), they might be trying to keep track of progress on multiple patterns at a time. So my thinking is it needs to be stored in the patterns
table, in a user-specific column.
How do I save the information from the dynamic row_ids_transposed
table to the patterns
table and load it when the user opens the same pattern again?
I am looking forward to some ideas! Let me know if you need more clarity.