better handling of Cardtype removal

Ticket

+commit
 

(Also see Can't remove or change Cardtype of Cardtype cards)

 

I tried to remove School (a Cardtype) and got "connecting to server..." for ~10 seconds then done but the card was still there. There was one card of that type, so i changed it to Basic, then removed the card.

Should get a warning of some kind i guess, and maybe the option to remove the card anyway (changing all those cards to Basic?).

Anyway, then i recreated School, as a Cardtype card, and it didn't show up as an option in Cardtype menus. So i tried changing it's Cardtype to Basic (thinking to then switch it back to Cardtype to see if that helpd), but just selecting Basic in the Cardtype menu got:

Oh, Man. You uncovered a bug in Wagn.

undefined method `class_name' for nil:NilClass

An email about this error has been sent to the authors of Wagn

500 Internal Server Error
.

 

Also, run code checking whether a cardtype can be deleted before showing all the other cards that would be deleted and asking if user really wants to do this.

 

 

Once this is fixed, delete unwanted cardtypes.


Seems to require deleting twice. E.g., on sandbox i deleted all Fruit cards, then deleted the Fruit card itself. (Aside: want better feedback, just got contacting server...done.) On http://sandbox.wagn.org/wagn/Cardtype the Fruit card was still listed, but returned:

RuntimeError: No class name for cardtype name Fruit
{"type":"_self"}

for the included +*type cards. Deleting it again seems to work. For a look at the situation after one deletion but before the second, see http://sandbox.wagn.org/wagn/faker

  --John Abbe.....Tue Jan 20 23:50:02 -0800 2009


I was having trouble reproducing this locally, but I looked at the code and found what seems to be the only step between deleting the cardtype extension (which worked in the faker example) and deleting the card itself (which didn't). I moved that step to after the card deletion, so Lew and I think this should work now.

Agree about need for better messaging. I would actually like to start gathering a bunch of these sorts of scenarios (invitation requests, deletions, etc) and try to design some unified card-centric solutions.

  --Ethan McCutchen.....Mon Jan 26 11:29:51 -0800 2009


On Sandwagn, just tried deleting the only card of cardtype barbar (which worked fine), then barbar itself. Got connecting to server...done but the cardslot still showed the confirmation (about deleting barbar+*tform and +*edit). Now barbar (and the + cards still exist, but trying to edit it gets a 500 error. ((removed reference to sandwagn))

 

  --John Abbe.....Fri Feb 06 02:01:52 -0800 2009


wow, that's frustrating. Can't reproduce it on my local copy. And I tried deleting several cardtypes on sandwagn, and most of them worked, and then foofoo busted.

Problem seems to be that something is failing after the extension is deleted but before the cardtype card itself is deleted. this leaves Wagn in a confused state where things bust.

  --Ethan McCutchen.....Mon Feb 09 23:02:11 -0800 2009


Just got 500 again trying to edit ((removed reference to sandwagn)) (will be overwritten if wagn.org data has been recopied there), while testing remove type submenu of cardtypes that have cards.

  --John Abbe.....Tue Feb 10 01:32:44 -0800 2009


In case this helps, just noticed that on sandbox, only five types are offered in Cardtype menu on new cards, even though there are plenty of Cardtype cards - http://sandbox.wagn.org/wagn/cardtype

  --John Abbe.....Tue Feb 10 02:59:40 -0800 2009


closed because it's covered in the other ticket (see top)

  --Ethan McCutchen.....Mon Feb 23 16:30:11 -0800 2009