Opened 7 years ago

Last modified 3 years ago

#5564 review defect

Show unprocessed media in processing panel

Reported by: ayleph Owned by:
Priority: major Milestone: 0.13.0
Component: programming Keywords:
Cc: Parent Tickets:

Description

Media with the state 'unprocessed' don't appear in the user or moderation processing panels. I'm splitting this off from #5491 as its own separate issue.

Change History (8)

comment:1 by ayleph, 7 years ago

Owner: set to ayleph
Status: newin_progress

comment:2 by ayleph, 7 years ago

I've done a quick implementation of showing unprocessed media on the moderation processing panel. Something similar could probably be done for the user processing panel. I'm considering trying to combine the 'unprocessed' media into the 'failed' media section, but I haven't decided if that makes sense.

--- a/mediagoblin/moderation/views.py
+++ b/mediagoblin/moderation/views.py
@@ -39,6 +39,10 @@ def moderation_media_processing_panel(request):
     failed_entries = MediaEntry.query.filter_by(state = u'failed').\
         order_by(MediaEntry.created.desc())
 
+    # Get media entries which are unprocessed
+    unprocessed_entries = MediaEntry.query.filter_by(state = u'unprocessed').\
+        order_by(MediaEntry.created.desc())
+
     processed_entries = MediaEntry.query.filter_by(state = u'processed').\
         order_by(MediaEntry.created.desc()).limit(10)
 
@@ -48,6 +52,7 @@ def moderation_media_processing_panel(request):
         'mediagoblin/moderation/media_panel.html',
         {'processing_entries': processing_entries,
          'failed_entries': failed_entries,
+         'unprocessed_entries': unprocessed_entries,
          'processed_entries': processed_entries})
 
 @require_admin_or_moderator_login
--- a/mediagoblin/templates/mediagoblin/moderation/media_panel.html
+++ b/mediagoblin/templates/mediagoblin/moderation/media_panel.html
@@ -101,9 +101,42 @@
 {% else %}
   <p><em>{% trans %}No failed entries!{% endtrans %}</em></p>
 {% endif %}
+
+<h2>{% trans %}These uploads are unprocessed:{% endtrans %}</h2>
+
+{% if unprocessed_entries.count() %}
+  <table class="media_panel failed">
+    <tr>
+      <th>{% trans %}ID{% endtrans %}</th>
+      <th>{% trans %}User{% endtrans %}</th>
+      <th>{% trans %}Title{% endtrans %}</th>
+      <th>{% trans %}When submitted{% endtrans %}</th>
+      <th>{% trans %}Reason for failure{% endtrans %}</th>
+      <th>{% trans %}Failure metadata{% endtrans %}</th>
+    </tr>
+    {% for media_entry in unprocessed_entries %}
+      <tr>
+        <td>{{ media_entry.id }}</td>
+        <td>{{ media_entry.get_actor.username }}</td>
+        <td>{{ media_entry.title }}</td>
+        <td>{{ media_entry.created.strftime("%F %R") }}</td>
+        {% if media_entry.get_fail_exception() %}
+        <td>{{ media_entry.get_fail_exception().general_message }}</td>
+        <td>{{ media_entry.fail_metadata }}</td>
+        {% else %}
+        <td>&nbsp;</td>
+        <td>&nbsp;</td>
+        {% endif %}
+      </tr>
+    {% endfor %}
+  </table>
+{% else %}
+  <p><em>{% trans %}No unprocessed entries!{% endtrans %}</em></p>
+{% endif %}
+
 <h2>{% trans %}Last 10 successful uploads{% endtrans %}</h2>
 {% if processed_entries.count() %}
 
   <table class="media_panel processed">

comment:3 by ShawnRisk, 6 years ago

Owner: ayleph removed
Status: in_progressreview

This should really be in a patch, yet I am putting this in review.

comment:4 by Ben Sturmfels, 5 years ago

Hi Ayleph,

This makes a lot of sense to me. Any chance you could attach a patch file for this please? See https://wiki.mediagoblin.org/Git_workflow eg. git format-patch --stdout <remote>/master > issue_<number>.patch

Thanks,
Ben

comment:5 by Ben Sturmfels, 5 years ago

When this is fixed, #644 can probably be closed too.

comment:6 by Ben Sturmfels, 5 years ago

Also when fixed, #176 and making uploads redirect to the processing panel would be a good next step.

comment:7 by Ben Sturmfels, 5 years ago

Should we also show the number of unprocessed in the top bar of all pages?

comment:8 by Ben Sturmfels, 3 years ago

Milestone: 0.13.0
Note: See TracTickets for help on using tickets.