PuzzleServer / mainpuzzleserver

The main repo for the Puzzle Hunt and Puzzleday servers.
MIT License
9 stars 31 forks source link

Final metapuzzle doesn't appear in puzzle list #356

Closed jaylorch closed 5 years ago

jaylorch commented 5 years ago

When I look at the list of puzzles I've authored (https://puzzlehunt.azurewebsites.net/1/author/Puzzles), my metameta doesn't appear. It used to appear on this page, so this is a regression.

tabascq commented 5 years ago

@jaylorch, I'm looking at the puzzle list in admin view and it's no longer there either.

tabascq commented 5 years ago

I found it by looking at dependencies of !!! Start the Event !!!; it exists and has puzzle ID 93. I cannot explain why it is not in the list, maybe its EventID got tweaked somehow. Going to try to find it in the raw SQL.

jaylorch commented 5 years ago

It does still exist, though, because I'm able to manually create URLs using the ID number I know it to have. Those pages still work, e.g., the Edit or Files pages. So I think it's just an issue with the list view.

jaylorch commented 5 years ago

Could it have something to do with the fact that that puzzle's version number is higher than 0 (unlike the other puzzles)? It got bumped up when I uploaded a new content file.

jaylorch commented 5 years ago

VersionNumber is a new field with this deployment; I don't know why the list view would care about it, though.

tabascq commented 5 years ago

The admin query is this:

            query = _context.Puzzles.Where(p => p.Event == Event);

This is why I think the EventID has been whacked somehow.

I do not know how to access the database. The connection string has fields like a password, which I do not know. @asyasky , @morganbr , @jenetlan : help needed here.

tabascq commented 5 years ago

One more idea: There's a join at the end that looks like this:

        Puzzles = await (from Puzzle p in query
                         join ContentFile joinFile in _context.ContentFiles on p equals joinFile.Puzzle into fileJoin
                         from ContentFile file in fileJoin.DefaultIfEmpty()
                         where file == null || file.FileType  == ContentFileType.Puzzle
                         orderby p.Group, p.OrderInGroup, p.Name
                         select new PuzzleView { Puzzle = p, Content = file }).ToListAsync();

and I noticed that this puzzle has materials but no puzzle file. Maybe there is an issue with the join that causes it to get confused in this case? I don't want to randomly attach files to your puzzle, @jaylorch , but you should give that a try.

tabascq commented 5 years ago

I have confirmed that having materials but no puzzle is the problem. I added materials to a puzzle in my local demo event and the puzzle vanished from admin, author, and player views. @morganbr , take note.

jaylorch commented 5 years ago

Ah, thanks for working that out. Hopefully the issue will get fixed soon.

tabascq commented 5 years ago

Is this something you need fixed? Do you intend to have a puzzle with no primary file?

Get Outlook for Androidhttps://aka.ms/ghei36


From: Jay Lorch notifications@github.com Sent: Saturday, March 30, 2019 1:43:08 PM To: PuzzleServer/mainpuzzleserver Cc: Kenny Young; Comment Subject: Re: [PuzzleServer/mainpuzzleserver] Final metapuzzle doesn't appear in puzzle list (#356)

Ah, thanks for working that out. Hopefully the issue will get fixed soon.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FPuzzleServer%2Fmainpuzzleserver%2Fissues%2F356%23issuecomment-478287810&data=02%7C01%7C%7C6728db401ed9420d776608d6b55051f7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636895753900160870&sdata=oQ%2BdJhTY%2FjMuIUQmB3xYrKkoyGao4owp9A4MhUVrA34%3D&reserved=0, or mute the threadhttps://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAodbB0EJgLXzS7bhwEEpQaqdH6H_ZoNyks5vb8xcgaJpZM4cT66K&data=02%7C01%7C%7C6728db401ed9420d776608d6b55051f7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636895753900180892&sdata=IY687WSp9hW6FG5hVF8likkRE%2FOBz9pwkCIruxVhuIQ%3D&reserved=0.

jaylorch commented 5 years ago

Yes, I have a puzzle with no primary file so I need it fixed. I can't set a primary file for it, or else the default link will go there instead of to the custom URL I set.

morganbr commented 5 years ago

@jaylorch, do you need a fix this weekend or is the workaround ok for a day or two?

Vroo commented 5 years ago

I also have a puzzle with no primary file. What we want is a left outer join and I don't think .DefaultIfEmpty() does that. I think you need to put an empty record there. That is, .DefaultIfEmpty(new ContentFile())

morganbr commented 5 years ago

The issue isn't DefaultIfEmpty, it's the check for ContentFileType.Puzzle. DefaultIfEmpty puts in a null ContentFile if the puzzle has no files at all, which works (and I've tested). The bug is that if the puzzle has a file that isn't ContentFileType.Puzzle (materials, solve tokens or answers), the whole thing gets filtered out. I probably need to change the outer join to not filter and then do something to get a unique set of puzzles.

jaylorch commented 5 years ago

I've replied to Morgan's question offline about whether I need a fix this weekend. (I don't think my answer has important spoilers, but maybe others would disagree.)

tabascq commented 5 years ago

I think I have an easy fix for this. PR coming up.

tabascq commented 5 years ago

The PR I posted fixes the behavior, though I'm not qualified to say whether it keeps the perf Morgan was trying to get. I think it does since I haven't touched the way the query returns results...