Opened 20 months ago

Last modified 8 weeks ago

#5564 review defect

Show unprocessed media in processing panel

Reported by: ayleph Owned by:
Priority: major Milestone:
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.

Subtickets

Change History (4)

comment:1 Changed 20 months ago by ayleph

Owner: set to ayleph
Status: newin_progress

comment:2 Changed 20 months ago by ayleph

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 Changed 13 months ago by ShawnRisk

Owner: ayleph deleted
Status: in_progressreview

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

comment:4 Changed 8 weeks ago by Ben Sturmfels

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

Note: See TracTickets for help on using tickets.