{"action":"created","comment":{"url":"https://api.github.com/repos/openfun/fun-apps/pulls/comments/24006726","id":24006726,"diff_hunk":"@@ -1,57 +1,128 @@\n {% extends 'backoffice/base.html' %}\n+{% load staticfiles %}\n+{% load  %}\n {% load url from future %}\n {% load i18n course %}\n \n-{% block content %}\n-\n+{% block extra_head %}\n <style>\n-  label.required :after {\n-     content:\" *\";\n-     color:red;\n-  }\n+#generate_test_certificate_button, #generate_certificate_button, .panel {\n+  margin : 15px;} \n </style>\n+{% endblock %}\n \n-<h1>{{ course.display_name_with_default }}</h1>\n-<h2>{% trans 'Certificate generation' %}</h2>\n-<form class=\"\" action=\"{% url 'backoffice-course-certificate' course.id %}\" method=\"post\">\n-  <fieldset>\n-    <legend>{% trans 'Student' %}</legend>\n-    <div class=\"form-group {% if student_form_certificate.full_name.errors %}has-error{% endif %}\">\n-      <label class=\"control-label required\"><span>{{ student_form_certificate.full_name.label }}</span></label>\n-      {{ student_form_certificate.full_name }}\n-      {% if student_form_certificate.full_name.errors %}\n-        {% for error in student_form_certificate.full_name.errors %}\n-          <p class=\"control-label\">{{ error|escape }}</p>\n-        {% endfor %}\n-      {% endif %}\n-    </div>\n-  </fieldset>\n-  <fieldset>\n-    <legend >{% trans 'Teachers' %}</legend>\n-\n-    {{ teachers_form_certificate.management_form }}\n-    {% csrf_token %}\n-    {% for teacher_form in teachers_form_certificate %}\n-      <div class=\"row\">\n-        {% for field in teacher_form %}\n-\n-        <div class=\"col-xs-4\">\n-          <div class=\"form-group{% if field.errors %} has-error{% endif %}\">\n-            <label for=\"\" class=\"control-label {% if forloop.parentloop.counter == 1 %} required{% endif %}\"><span>{{ field.label }}</span></label>\n-            {{ field }}\n-            {% if field.errors %}\n-              {% for error in field.errors %}\n-                <p class=\"control-label\">{{ error|escape }}</p>\n-              {% endfor %}\n-            {% endif %}\n-          </div>\n-        </div>\n-        {% endfor %}\n+{% block extr_js %}\n+<script src=\"{% static 'backoffice/js/pending_tasks.js' %}\"></script>\n+{% endblock %}\n+\n+{% block content %}\n+<h2>{{ course.display_name_with_default }}</h2>\n+\n+<a class=\"btn btn-primary\"  id=\"generate_test_certificate_button\" href=\"{% url 'generate-test-certificate' course.id %}\" data-certificate-base-url=\"{{certificate_base_url}}\">{% trans 'Generate test certificate' %} </a>\n+<a class=\"btn btn-danger\" id=\"generate_certificate_button\" data-toggle=\"modal\" data-target=\"#certificate-generation-modal\">  {% trans 'Generate certificates' %} </a>\n+\n+<!-- First Panel : pending certificate generations tasks -->\n+\n+{% if instructor_tasks and instructor_tasks|length > 0 %}\n+  <div class=\"panel panel-danger\">\n+    <!-- Default panel contents -->\n+    <div class=\"panel-heading\">  {% trans \"Pending Certificate Tasks\"%}</div>\n+      <!-- Table -->\n+      <div id=\"task-progress-wrapper\">\n+        <table class=\"table\">\n+          <tr>\n+            <th>{% trans \"Certificate\"%}</th>\n+            <th>{% trans \"Enrolled students\"%}</th>\n+            <th>{% trans \"Students with certification\"%}</th>\n+            <th>{% trans \"Students without certification\"%}</th>\n+            <th>{% trans \"Task State\"%}</th>\n+            <th>{% trans \"Task Start\" %}</th>\n+            <th>{% trans \"Total Duration (sec)\"%}</th>\n+            <th>{% trans \"Requester\"%}</th>\n+          </tr>\n+          {% for instructor_task in instructor_tasks %}\n+            <tr id=\"task-progress-entry-{{forloop.counter}}\" class=\"task-progress-entry\"\n+              data-task-id=\"{{instructor_task.task_id}}\"\n+              data-in-progress=\"true\">\n+              <td>\n+                <a class=\"task-certificate-pdf\"  href=\"\"> {% trans \"Sample\" %} </a>\n+              </td>\n+              <td class=\"task-enrolled-students\">{{instructor_task.task_output.total}}</td>\n+              <td class=\"task-certified-students\">{{instructor_task.task_output.downloadable}}</td>\n+              <td class=\"task-not-certified-students\">{{instructor_task.task_output.notpassing}}</td>\n+              <td class=\"task-state\">{{instructor_task.task_state}}</td>\n+              <td>{{instructor_task.created}}</td>\n+              <td class=\"task-duration\">{% trans \"unknown\" %}</td>\n+              <td>{{instructor_task.requester}}</td>\n+            </tr>\n+          {% endfor %}\n+        </table>\n       </div>\n-    {% endfor %}\n+  </div>\n+{% endif %}\n+\n+<!-- Second Panel : Previous certificate generations tasks -->\n \n-  <input class=\"btn btn-primary\" type=\"submit\" value=\"{% trans 'Generate test certificate' %}\">\n+{% if instructor_tasks_history and instructor_tasks_history|length > 0 %}\n+  {% if instructor_tasks and instructor_tasks_history|length == 1 and instructor_tasks_history.0.task_id == instructor_tasks.0.task_id %}\n+  {% else %}\n+   <div class=\"panel panel-info\">\n+     <div class=\"panel-heading\">  {% trans \"Previous Certificate Tasks\"%}</div>\n+       <div id=\"task-progress-wrapper-history\">\n+         <table class=\"table\">\n+           <tr>\n+             <th>{% trans \"Certificate\"%}</th>\n+             <th>{% trans \"Enrolled students\"%}</th>\n+             <th>{% trans \"Students with certification\"%}</th>\n+             <th>{% trans \"Students without certification\"%}</th>\n+             <th>{% trans \"Task State\"%}</th>\n+             <th>{% trans \"Task Start\" %}</th>\n+             <th>{% trans \"Requester\"%}</th>\n+           </tr>\n+           {% for instructor_task in instructor_tasks_history %}\n+             {% if instructor_tasks and instructor_task.task_id == instructor_tasks.0.task_id %}\n+             {% else %}\n+               <tr id=\"task-progress-entry-{{forloop.counter}}\" class=\"task-progress-entry\"\n+                  data-task-id=\"{{instructor_task.task_id}}\"\n+                  data-in-progress=\"true\">\n+                 <td class=\"task-certificate-pdf\">\n+                   <a href=\"{{certificate_base_url}}{{instructor_task.task_output.test_certificate_filename}}\">{% trans \"Sample\" %}</a>\n+                 </td>\n+                 <td class=\"task-enrolled-students\">{{instructor_task.task_output.total}}</td>\n+                 <td class=\"task-certified-students\">{{instructor_task.task_output.downloadable}}</td>\n+                 <td class=\"task-not-certified-students\">{{instructor_task.task_output.notpassing}}</td>\n+                 <td class=\"task-state\">{{instructor_task.task_state}}</td>\n+                 <td>{{instructor_task.created}}</td>\n+                 <td>{{instructor_task.requester}}</td>\n+               </tr>\n+             {% endif %}\n+           {% endfor %}\n+         </table>","path":"backoffice/templates/backoffice/certificate.html","position":144,"original_position":144,"commit_id":"aaaca99e6943a6904dfba3cb5b2b10501f7be529","original_commit_id":"aaaca99e6943a6904dfba3cb5b2b10501f7be529","user":{"login":"jpaille","id":2971857,"avatar_url":"https://avatars.githubusercontent.com/u/2971857?v=3","gravatar_id":"","url":"https://api.github.com/users/jpaille","html_url":"https://github.com/jpaille","followers_url":"https://api.github.com/users/jpaille/followers","following_url":"https://api.github.com/users/jpaille/following{/other_user}","gists_url":"https://api.github.com/users/jpaille/gists{/gist_id}","starred_url":"https://api.github.com/users/jpaille/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpaille/subscriptions","organizations_url":"https://api.github.com/users/jpaille/orgs","repos_url":"https://api.github.com/users/jpaille/repos","events_url":"https://api.github.com/users/jpaille/events{/privacy}","received_events_url":"https://api.github.com/users/jpaille/received_events","type":"User","site_admin":false},"body":"Ce sont deux tableaux différents","created_at":"2015-02-03T14:35:00Z","updated_at":"2015-02-03T14:35:00Z","html_url":"https://github.com/openfun/fun-apps/pull/37#discussion_r24006726","pull_request_url":"https://api.github.com/repos/openfun/fun-apps/pulls/37","_links":{"self":{"href":"https://api.github.com/repos/openfun/fun-apps/pulls/comments/24006726"},"html":{"href":"https://github.com/openfun/fun-apps/pull/37#discussion_r24006726"},"pull_request":{"href":"https://api.github.com/repos/openfun/fun-apps/pulls/37"}}},"pull_request":{"url":"https://api.github.com/repos/openfun/fun-apps/pulls/37","id":28551877,"html_url":"https://github.com/openfun/fun-apps/pull/37","diff_url":"https://github.com/openfun/fun-apps/pull/37.diff","patch_url":"https://github.com/openfun/fun-apps/pull/37.patch","issue_url":"https://api.github.com/repos/openfun/fun-apps/issues/37","number":37,"state":"open","locked":false,"title":"Jpaille/1130 add certificate generation task to backoffice","user":{"login":"jpaille","id":2971857,"avatar_url":"https://avatars.githubusercontent.com/u/2971857?v=3","gravatar_id":"","url":"https://api.github.com/users/jpaille","html_url":"https://github.com/jpaille","followers_url":"https://api.github.com/users/jpaille/followers","following_url":"https://api.github.com/users/jpaille/following{/other_user}","gists_url":"https://api.github.com/users/jpaille/gists{/gist_id}","starred_url":"https://api.github.com/users/jpaille/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpaille/subscriptions","organizations_url":"https://api.github.com/users/jpaille/orgs","repos_url":"https://api.github.com/users/jpaille/repos","events_url":"https://api.github.com/users/jpaille/events{/privacy}","received_events_url":"https://api.github.com/users/jpaille/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-02-03T13:28:59Z","updated_at":"2015-02-03T14:35:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"222f459dce8a6d0424c6b5c5ea44e6db68e23e5e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openfun/fun-apps/pulls/37/commits","review_comments_url":"https://api.github.com/repos/openfun/fun-apps/pulls/37/comments","review_comment_url":"https://api.github.com/repos/openfun/fun-apps/pulls/comments/{number}","comments_url":"https://api.github.com/repos/openfun/fun-apps/issues/37/comments","statuses_url":"https://api.github.com/repos/openfun/fun-apps/statuses/aaaca99e6943a6904dfba3cb5b2b10501f7be529","head":{"label":"openfun:jpaille/1130-add-certificate-generation-task-to-backoffice","ref":"jpaille/1130-add-certificate-generation-task-to-backoffice","sha":"aaaca99e6943a6904dfba3cb5b2b10501f7be529","user":{"login":"openfun","id":7224891,"avatar_url":"https://avatars.githubusercontent.com/u/7224891?v=3","gravatar_id":"","url":"https://api.github.com/users/openfun","html_url":"https://github.com/openfun","followers_url":"https://api.github.com/users/openfun/followers","following_url":"https://api.github.com/users/openfun/following{/other_user}","gists_url":"https://api.github.com/users/openfun/gists{/gist_id}","starred_url":"https://api.github.com/users/openfun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openfun/subscriptions","organizations_url":"https://api.github.com/users/openfun/orgs","repos_url":"https://api.github.com/users/openfun/repos","events_url":"https://api.github.com/users/openfun/events{/privacy}","received_events_url":"https://api.github.com/users/openfun/received_events","type":"Organization","site_admin":false},"repo":{"id":20556967,"name":"fun-apps","full_name":"openfun/fun-apps","owner":{"login":"openfun","id":7224891,"avatar_url":"https://avatars.githubusercontent.com/u/7224891?v=3","gravatar_id":"","url":"https://api.github.com/users/openfun","html_url":"https://github.com/openfun","followers_url":"https://api.github.com/users/openfun/followers","following_url":"https://api.github.com/users/openfun/following{/other_user}","gists_url":"https://api.github.com/users/openfun/gists{/gist_id}","starred_url":"https://api.github.com/users/openfun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openfun/subscriptions","organizations_url":"https://api.github.com/users/openfun/orgs","repos_url":"https://api.github.com/users/openfun/repos","events_url":"https://api.github.com/users/openfun/events{/privacy}","received_events_url":"https://api.github.com/users/openfun/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openfun/fun-apps","description":"","fork":false,"url":"https://api.github.com/repos/openfun/fun-apps","forks_url":"https://api.github.com/repos/openfun/fun-apps/forks","keys_url":"https://api.github.com/repos/openfun/fun-apps/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openfun/fun-apps/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openfun/fun-apps/teams","hooks_url":"https://api.github.com/repos/openfun/fun-apps/hooks","issue_events_url":"https://api.github.com/repos/openfun/fun-apps/issues/events{/number}","events_url":"https://api.github.com/repos/openfun/fun-apps/events","assignees_url":"https://api.github.com/repos/openfun/fun-apps/assignees{/user}","branches_url":"https://api.github.com/repos/openfun/fun-apps/branches{/branch}","tags_url":"https://api.github.com/repos/openfun/fun-apps/tags","blobs_url":"https://api.github.com/repos/openfun/fun-apps/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openfun/fun-apps/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openfun/fun-apps/git/refs{/sha}","trees_url":"https://api.github.com/repos/openfun/fun-apps/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openfun/fun-apps/statuses/{sha}","languages_url":"https://api.github.com/repos/openfun/fun-apps/languages","stargazers_url":"https://api.github.com/repos/openfun/fun-apps/stargazers","contributors_url":"https://api.github.com/repos/openfun/fun-apps/contributors","subscribers_url":"https://api.github.com/repos/openfun/fun-apps/subscribers","subscription_url":"https://api.github.com/repos/openfun/fun-apps/subscription","commits_url":"https://api.github.com/repos/openfun/fun-apps/commits{/sha}","git_commits_url":"https://api.github.com/repos/openfun/fun-apps/git/commits{/sha}","comments_url":"https://api.github.com/repos/openfun/fun-apps/comments{/number}","issue_comment_url":"https://api.github.com/repos/openfun/fun-apps/issues/comments/{number}","contents_url":"https://api.github.com/repos/openfun/fun-apps/contents/{+path}","compare_url":"https://api.github.com/repos/openfun/fun-apps/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openfun/fun-apps/merges","archive_url":"https://api.github.com/repos/openfun/fun-apps/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openfun/fun-apps/downloads","issues_url":"https://api.github.com/repos/openfun/fun-apps/issues{/number}","pulls_url":"https://api.github.com/repos/openfun/fun-apps/pulls{/number}","milestones_url":"https://api.github.com/repos/openfun/fun-apps/milestones{/number}","notifications_url":"https://api.github.com/repos/openfun/fun-apps/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openfun/fun-apps/labels{/name}","releases_url":"https://api.github.com/repos/openfun/fun-apps/releases{/id}","created_at":"2014-06-06T08:42:58Z","updated_at":"2015-02-03T14:10:06Z","pushed_at":"2015-02-03T14:10:06Z","git_url":"git://github.com/openfun/fun-apps.git","ssh_url":"git@github.com:openfun/fun-apps.git","clone_url":"https://github.com/openfun/fun-apps.git","svn_url":"https://github.com/openfun/fun-apps","homepage":"","size":8900,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":0,"default_branch":"dev"}},"base":{"label":"openfun:master","ref":"master","sha":"8a8060c5660074bac197f411ee64ab35066c8bbf","user":{"login":"openfun","id":7224891,"avatar_url":"https://avatars.githubusercontent.com/u/7224891?v=3","gravatar_id":"","url":"https://api.github.com/users/openfun","html_url":"https://github.com/openfun","followers_url":"https://api.github.com/users/openfun/followers","following_url":"https://api.github.com/users/openfun/following{/other_user}","gists_url":"https://api.github.com/users/openfun/gists{/gist_id}","starred_url":"https://api.github.com/users/openfun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openfun/subscriptions","organizations_url":"https://api.github.com/users/openfun/orgs","repos_url":"https://api.github.com/users/openfun/repos","events_url":"https://api.github.com/users/openfun/events{/privacy}","received_events_url":"https://api.github.com/users/openfun/received_events","type":"Organization","site_admin":false},"repo":{"id":20556967,"name":"fun-apps","full_name":"openfun/fun-apps","owner":{"login":"openfun","id":7224891,"avatar_url":"https://avatars.githubusercontent.com/u/7224891?v=3","gravatar_id":"","url":"https://api.github.com/users/openfun","html_url":"https://github.com/openfun","followers_url":"https://api.github.com/users/openfun/followers","following_url":"https://api.github.com/users/openfun/following{/other_user}","gists_url":"https://api.github.com/users/openfun/gists{/gist_id}","starred_url":"https://api.github.com/users/openfun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openfun/subscriptions","organizations_url":"https://api.github.com/users/openfun/orgs","repos_url":"https://api.github.com/users/openfun/repos","events_url":"https://api.github.com/users/openfun/events{/privacy}","received_events_url":"https://api.github.com/users/openfun/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openfun/fun-apps","description":"","fork":false,"url":"https://api.github.com/repos/openfun/fun-apps","forks_url":"https://api.github.com/repos/openfun/fun-apps/forks","keys_url":"https://api.github.com/repos/openfun/fun-apps/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openfun/fun-apps/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openfun/fun-apps/teams","hooks_url":"https://api.github.com/repos/openfun/fun-apps/hooks","issue_events_url":"https://api.github.com/repos/openfun/fun-apps/issues/events{/number}","events_url":"https://api.github.com/repos/openfun/fun-apps/events","assignees_url":"https://api.github.com/repos/openfun/fun-apps/assignees{/user}","branches_url":"https://api.github.com/repos/openfun/fun-apps/branches{/branch}","tags_url":"https://api.github.com/repos/openfun/fun-apps/tags","blobs_url":"https://api.github.com/repos/openfun/fun-apps/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openfun/fun-apps/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openfun/fun-apps/git/refs{/sha}","trees_url":"https://api.github.com/repos/openfun/fun-apps/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openfun/fun-apps/statuses/{sha}","languages_url":"https://api.github.com/repos/openfun/fun-apps/languages","stargazers_url":"https://api.github.com/repos/openfun/fun-apps/stargazers","contributors_url":"https://api.github.com/repos/openfun/fun-apps/contributors","subscribers_url":"https://api.github.com/repos/openfun/fun-apps/subscribers","subscription_url":"https://api.github.com/repos/openfun/fun-apps/subscription","commits_url":"https://api.github.com/repos/openfun/fun-apps/commits{/sha}","git_commits_url":"https://api.github.com/repos/openfun/fun-apps/git/commits{/sha}","comments_url":"https://api.github.com/repos/openfun/fun-apps/comments{/number}","issue_comment_url":"https://api.github.com/repos/openfun/fun-apps/issues/comments/{number}","contents_url":"https://api.github.com/repos/openfun/fun-apps/contents/{+path}","compare_url":"https://api.github.com/repos/openfun/fun-apps/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openfun/fun-apps/merges","archive_url":"https://api.github.com/repos/openfun/fun-apps/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openfun/fun-apps/downloads","issues_url":"https://api.github.com/repos/openfun/fun-apps/issues{/number}","pulls_url":"https://api.github.com/repos/openfun/fun-apps/pulls{/number}","milestones_url":"https://api.github.com/repos/openfun/fun-apps/milestones{/number}","notifications_url":"https://api.github.com/repos/openfun/fun-apps/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openfun/fun-apps/labels{/name}","releases_url":"https://api.github.com/repos/openfun/fun-apps/releases{/id}","created_at":"2014-06-06T08:42:58Z","updated_at":"2015-02-03T14:10:06Z","pushed_at":"2015-02-03T14:10:06Z","git_url":"git://github.com/openfun/fun-apps.git","ssh_url":"git@github.com:openfun/fun-apps.git","clone_url":"https://github.com/openfun/fun-apps.git","svn_url":"https://github.com/openfun/fun-apps","homepage":"","size":8900,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":0,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/openfun/fun-apps/pulls/37"},"html":{"href":"https://github.com/openfun/fun-apps/pull/37"},"issue":{"href":"https://api.github.com/repos/openfun/fun-apps/issues/37"},"comments":{"href":"https://api.github.com/repos/openfun/fun-apps/issues/37/comments"},"review_comments":{"href":"https://api.github.com/repos/openfun/fun-apps/pulls/37/comments"},"review_comment":{"href":"https://api.github.com/repos/openfun/fun-apps/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/openfun/fun-apps/pulls/37/commits"},"statuses":{"href":"https://api.github.com/repos/openfun/fun-apps/statuses/aaaca99e6943a6904dfba3cb5b2b10501f7be529"}}}}