Closed t2t2 closed 9 years ago
Huh. So it just hangs around in the DB, but doesn't show on the league page, correct?
It deletes the league <-> movie link, but not the league - movie - user link.
Unless there was some weirdass corruption happening on the database
Hey. I thought I'd use this as an opportunity to get a little familiar with the code. Below is the snippet I think is responsible, from LeagueAdminController.php. Unfortunately, I read over quite a few times without finding anything wrong. The long if statement looks like the most error prone part, but since the movie is being removed from the league, the if statement should be working. As far as I can tell, there is nothing wrong with the for loop removing player movie league relationships.
if(Input::has('remove') && filter_var(Input::get('remove'), FILTER_VALIDATE_INT) !== false && $movie = $league->movies->find(Input::get('remove'))) {
// Remove any possible attached players
foreach ($movie->users as $user) {
$query = DB::table('league_movie_user')->whereLeagueId($league->id)->whereMovieId($movie->id)->whereUserId($user->id);
$query->delete();
if(array_search($user->id, $update_players) === false) {
$update_players[] = $user->id;
}
}
// Remove movie
$league->movies()->detach($movie->id);
// Instead of adding it to changes count, have a seperate notification
Notification::success('Movie '.e($movie->name).' has been removed from the league.');
}
One more report of something being weird: https://twitter.com/rclaybones/status/453247379408318465
That is strange. Honestly, this will be our real first season of heavy usage so we're bound to find bugs and weird oddities. — Sent from Mailbox for iPhone
On Mon, Apr 7, 2014 at 2:11 PM, t2t2 notifications@github.com wrote:
One more report of something being weird: https://twitter.com/rclaybones/status/453247379408318465
Reply to this email directly or view it on GitHub: https://github.com/t2t2/draft/issues/26#issuecomment-39770892
Looks like there might be a bug with some browsers submitting via delete buttons, does anyone e have an iPad to test with?
I've got one. Let me know the things to recreate or if you've got a special link for tracking. — Sent from Mailbox for iPhone
On Mon, Apr 7, 2014 at 5:46 PM, t2t2 notifications@github.com wrote:
Looks like there might be a bug with some browsers submitting via delete buttons, does anyone e have an iPad to test with?
https://twitter.com/rclaybones/status/453300222761136129
Reply to this email directly or view it on GitHub: https://github.com/t2t2/draft/issues/26#issuecomment-39793204
Made a test case: http://t2t2.eu/test/draftr_form.php
And it looks like it's something that can happen in any browser if enter is used to submit the form
I was able to fix it by adding this to the beginning of the form:
<input type="submit" value="Save" class="btn-primary btn" style="visibility: hidden;">
I submitted a pull request, but that was mostly just because I had never done one before and wanted to see how they worked. The code hasn't been tested on a running instance of draft. Let me know what you think.
There might be a bug where if a player deletes a movie from the league it doesn't get removed from league_movie_user table
Test data: