Skip to content

Commit

Permalink
Fix unapproved and awaiting review list
Browse files Browse the repository at this point in the history
  • Loading branch information
Xpirix committed Jul 31, 2024
1 parent 591f2ea commit 42d6e9d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
24 changes: 21 additions & 3 deletions qgis-app/plugins/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,16 @@ def get_queryset(self):
super(UnapprovedPlugins, self)
.get_queryset()
.filter(pluginversion__approved=False, deprecated=False)
.extra(
select={
"average_vote": "rating_score/(rating_votes+0.001)",
"latest_version_date": (
"SELECT created_on FROM plugins_pluginversion WHERE "
"plugins_pluginversion.plugin_id = plugins_plugin.id "
"ORDER BY created_on DESC LIMIT 1"
),
}
)
.distinct()
)

Expand Down Expand Up @@ -292,7 +302,8 @@ def get_queryset(self):
super(FeedbackCompletedPlugins, self)
.get_queryset()
.filter(
pluginversion__approved=False
pluginversion__approved=False,
deprecated=False
)
.annotate(
total_feedback_count=Count('pluginversion__feedback'),
Expand Down Expand Up @@ -329,7 +340,8 @@ def get_queryset(self):
super(FeedbackReceivedPlugins, self)
.get_queryset()
.filter(
pluginversion__approved=False
pluginversion__approved=False,
deprecated=False
)
.annotate(
received_feedback_count=Subquery(feedback_count_subquery)
Expand Down Expand Up @@ -360,7 +372,13 @@ def get_queryset(self):
.get_queryset()
.filter(
pluginversion__approved=False,
pluginversion__feedback__isnull=True
deprecated=False
)
.annotate(
total_feedback_count=Count('pluginversion__feedback'),
)
.filter(
total_feedback_count=0
)
.extra(
select={
Expand Down
4 changes: 2 additions & 2 deletions qgis-app/plugins/templates/plugins/plugin_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ <h3>{% trans "Plugins" %}</h3>
{% if user.is_staff %}
<li class="staff"><a href="{% url "unapproved_plugins" %}">{% trans "Unapproved"%}</a></li>
<ul>
<li class="sub-list"><a href="{% url "feedback_completed_plugins" %}">{% trans "Resolved comments"%}</a></li>
<li class="sub-list"><a href="{% url "feedback_received_plugins" %}">{% trans "Awaiting comments resolution"%}</a></li>
<li class="sub-list"><a href="{% url "feedback_completed_plugins" %}">{% trans "Reviewed plugins (Resolved comments)"%}</a></li>
<li class="sub-list"><a href="{% url "feedback_received_plugins" %}">{% trans "Reviewed plugins (Awaiting comments resolution)"%}</a></li>
<li class="sub-list"><a href="{% url "feedback_pending_plugins" %}">{% trans "Awaiting review"%}</a></li>
</ul>
<li class="staff"><a href="{% url "deprecated_plugins" %}">{% trans "Deprecated"%}</a></li>
Expand Down
8 changes: 4 additions & 4 deletions qgis-app/plugins/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
url(
r"^unapproved/$",
PluginsList.as_view(
queryset=Plugin.unapproved_objects.all(),
queryset=Plugin.unapproved_objects.all().order_by("-latest_version_date"),
additional_context={"title": _("Unapproved plugins")},
),
name="unapproved_plugins",
Expand Down Expand Up @@ -208,21 +208,21 @@
url(
r"^feedback_completed/$",
FeedbackCompletedPluginsList.as_view(
additional_context={"title": _("Feedback completed plugins")}
additional_context={"title": _("Reviewed plugins (Resolved comments)")}
),
name="feedback_completed_plugins",
),
url(
r"^feedback_pending/$",
FeedbackPendingPluginsList.as_view(
additional_context={"title": _("Feedback pending plugins")}
additional_context={"title": _("Awaiting review")}
),
name="feedback_pending_plugins",
),
url(
r"^feedback_received/$",
FeedbackReceivedPluginsList.as_view(
additional_context={"title": _("Feedback received plugins")}
additional_context={"title": _("Reviewed plugins (Awaiting comments resolution)")}
),
name="feedback_received_plugins",
),
Expand Down

0 comments on commit 42d6e9d

Please sign in to comment.