Open peterbe opened 5 years ago
Also, fixing this would be we don't need to correct the excessive plural s
on times
.
Perhaps here it could instead do:
def _duplicate_queries(self, output):
"""Appends the most common duplicate queries to the given output."""
if QC_SETTINGS['DISPLAY_DUPLICATES']:
for query, count in self.queries.most_common(QC_SETTINGS['DISPLAY_DUPLICATES']):
if count <= 1:
continue
lines = ['\nRepeated {0} times.'.format(count)]
...
Maybe "Executed" would be more appropriate than "Repeated", but please note that sometimes it is useful to dump all queries. With the current implementation, this can easily be achieved by setting a big value for the DISPLAY_DUPLICATES setting
I've just included this project into my Django app, and I was extremely surprised when I saw a whole bunch of queries show up saying they were repeated 1 time, when really the total count is 1. "Repeated 1 time" means that the query was executed twice, right? So maybe it's just a matter of improving the wording that's used, so don't say "repeated" but "executed" or something.
Agreed that there's some work to do here. I've added this to the next release milestone & hope to sprint on it over the next few weeks.
It prints this:
But I think it actually ever happens 1 time for that request. So, the logic for this inclusion should be something like
[query for queries if query.times > 1]
.