ctm / mb2-doc

Mb2, poker software
https://devctm.com
7 stars 2 forks source link

Dynamically updated Structure Sheets while creating tournament #1440

Closed ctm closed 2 weeks ago

ctm commented 2 weeks ago

Make it so that when people are creating a tournament, if they click the circle-i they get a tentative structure sheet.

Currently, when people are creating a tournament, the circle-i takes them to a template for the structure they currently have selected. Instead, we can bring them to something like /structure/new and then send information from the parent window to the child window. That information would be the choices currently selected, then as choices are changed, we could update the child window.

This is easily done, but we need to implement structure sheets (#1439), first. It's not a high priority both because the functionality isn't really that important and because we still have about a month of the WSOP-Style series left and in round numbers, nobody will be creating tournaments during it.

ctm commented 2 weeks ago

I'm doing a "before mom gets up" spike to see if I can set up the communication pathway from parent window to child window. I'm doing this now because I deployed structure sheets for upcoming and running events already, but haven't yet adjusted how level durations are dealt with, and I think they can be done a little more cleanly in templates if we don't use templates directly during tournament creation. Here's what I'll explore this morning:

Turns out, it took me a while just to write up this list, because I've been browsing MDN. postMessage has some intricacies I'm still exploring.

ctm commented 2 weeks ago

Since web_sys::Window::post_message_with_transfer uses JsValue for both the message and the transfer parameters, there's no option to use postcard into an ArrayBuffer. Considering the small size of the payload in the infrequency of transfer, this restriction actually makes things easier because it means I shouldn't (honestly!) spend any time looking into serializing via postcard. We'll just use JsValueSerdeExt.

ctm commented 2 weeks ago

Turns it was better to use serde-wasm-bindgen than JsValueSerdeExt, but I do have the pathway working. So now the child window gets the initial state of the create dialog and gets a new state any time the state is changed. The remaining steps are:

ctm commented 2 weeks ago

This was supposed to just be a little bit of exploration yesterday morning, but mom's schedule went kittywampus yesterday and I chose to work on this issue in between events in her day. Now I'm close to results and I have "an hour" "to spare", so I'll push on and try to get it deployed today or tomorrow, not because it's important, but just to finish it and get it out of the way.

ctm commented 2 weeks ago

Done. Deploying now.

Decided to not test with second granularity because it'll only take a minute to test with minute granularity and it'll take more than a minute to set up the test with second granularity. OTOH, each time the minute granularity test fails, I have to poke around, make changes and/or add instrumentation and then test again, and then wait up to a minute to see my results. In the grand scheme of things, that extra minute doesn't mean much, but it'd be frustrating, however the minute granularity test worked on the first try. I love Rust.