浏览代码

Correction premier film dans liste

Sangfroid 2 月之前
父节点
当前提交
0c15736ae0
共有 2 个文件被更改,包括 6 次插入2 次删除
  1. 4 0
      src/Controller/IndexController.php
  2. 2 2
      templates/index/index.html.twig

+ 4 - 0
src/Controller/IndexController.php

@@ -138,6 +138,10 @@ class IndexController extends AbstractController
             }
         } elseif ($fromList === 'common' && $toList === 'user') {
             $last = end($userListFilms);
+            if (!$last) {
+                $newUserListFilm->setPosition(0);
+                return;
+            }
             $positionLast = $last->getPosition();
             $newUserListFilm->setPosition($positionLast + 1);
 

+ 2 - 2
templates/index/index.html.twig

@@ -54,8 +54,8 @@
             <td>{{ film.name }}</td>
             <td>{{ film.realisateur }}</td>
             <td>{{ film.genre }}</td>
-            <td></td>
-            <td></td>
+            <td>{{ (film.commonLists | first).addedBy.email }}</td>
+            <td>{{ (film.commonLists | first).dateAdded | date('d/m/Y') }}</td>
         </tr>
         {% endfor %}
     </tbody>