ctm / mb2-doc

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

N Autostart doesn't disable start at in dynamic structure sheets #1444

Closed ctm closed 2 weeks ago

ctm commented 2 weeks ago

Fix so that if N Players Auotstart is chosen during event creation, Start At doesn't show up in the tentative structure sheet.

I should have checked this before deploying, but I thought we do a faithful reproduction of what is in NewEvent so I didn't anticipate it. The problem is that we have some additional rules that we apply in models::EventRow::create, one being:

        if parameters.n_players_autostart.is_some() {
            start_at = None;
        }

That was fine when the user could only see the creation modal before creating, because by the time the user could see anything else, that code was hit.

The solution is to hoist all similar code out of NewEvent::create and into something that is called by both the code that calls NewEvent::create and is also called by StructureSheetDetails::tournament. It does not make sense to do the n-players-autostart xor create-at hack in the creation modal UI, because we currently keep the create-at just in case a value in n-players-autostart was an error and the user erases it.

ctm commented 2 weeks ago

I chose not to hoist the code. Instead, I replicated the semantics, because it makes more sense to fix "properly" more things than just this, but this should be fixed sooner rather than later, because currently incorrect info is being produced.

It's such a small fix, I've put it in master, but I'm not deploying until later today when I'll have done more work on various small issues (#1445).