Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Translation preparation for tracdb app #1689

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions djangoproject/templates/tracdb/bouncing_tickets.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
{% extends "base_community.html" %}
{% load i18n %}

{% block content-related %}{% endblock %}

{% block title %}Bouncing Tickets{% endblock %}
{% block title %}{% translate "Bouncing Tickets" %}{% endblock %}

{% block content %}

<h1>Bouncing Tickets</h1>
<h1>{% translate "Bouncing Tickets" %}</h1>

<h2 class="deck">Tickets that have been repeatedly reopened.</h2>
<h2 class="deck">{% translate "Tickets that have been repeatedly reopened." %}</h2>

<table width="90%" class="docutils">
<thead>
<tr>
<th>Ticket</th>
<th>Times reopened</th>
<th>Last reopened</th>
<th>{% translate "Ticket" %}</th>
<th>{% translate "Times reopened" %}</th>
<th>{% translate "Last reopened" %}</th>
</tr>
</thead>
<tbody>
Expand Down
6 changes: 3 additions & 3 deletions tracdb/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Some models for pulling data from Trac.

Initially generated by inspectdb then modified heavily by hand, often by
consulting http://trac.edgewall.org/wiki/TracDev/DatabaseSchema.
consulting https://trac.edgewall.org/wiki/TracDev/DatabaseSchema.

A few notes on tables that're left out and why:
A few notes on tables that are left out and why:

* All the session and permission tables: they're just not needed.
* Enum: I don't know what this is or what it's for.
Expand All @@ -25,7 +25,7 @@

To make these work with Django (for some definition of the word "work") we mark only
one of their field as being the primary key (primary_key=True).
This is obviously incorrect but — somewhat suprisingly — it doesn't break **everything**
This is obviously incorrect but — somewhat surprisingly — it doesn't break **everything**
and the little that does actually work is good enough for what we're trying to do:

* Model.objects.create(...) correctly creates the object in the db
Expand Down
9 changes: 5 additions & 4 deletions tracdb/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from collections import OrderedDict, namedtuple

from django.conf import settings
from django.utils.translation import gettext_lazy as _

from .models import Revision, Ticket, TicketChange

Expand Down Expand Up @@ -41,7 +42,7 @@ def get_user_stats(username):
return stats


@stat("Commits")
@stat(_("Commits"))
def commit_count(username):
count = Revision.objects.filter(author=username).count()
# This assumes that the username is their GitHub username, this is very
Expand All @@ -50,23 +51,23 @@ def commit_count(username):
return StatData(count=count, link=link)


@stat("Tickets fixed")
@stat(_("Tickets fixed"))
def tickets_fixed(username):
query = f"owner={username}&resolution=fixed"
count = Ticket.objects.from_querystring(query).count()
link = get_trac_link(query)
return StatData(count=count, link=link)


@stat("Tickets opened")
@stat(_("Tickets opened"))
def tickets_opened(username):
query = f"reporter={username}"
count = Ticket.objects.from_querystring(query).count()
link = get_trac_link(query)
return StatData(count=count, link=link)


@stat("New tickets triaged")
@stat(_("New tickets triaged"))
def new_tickets_reviewed(username):
# We don't want to de-dup as for tickets_closed: multiple reviews of the
# same ticket should "count" as a review.
Expand Down