Closed Bug 503024 Opened 17 years ago Closed 15 years ago

Logged in homepage

Categories

(Webtools Graveyard :: Cesium, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: rdoherty, Unassigned)

References

Details

Attachments

(1 file)

The logged in homepage view for Cesium should show some sort of news feed/alert list of changes that occurred in the last 24-48 hours. (or longer if nothing has happened since then. Events could be: * Site ySlow score increasing/decreasing a significant amount (tbd) * Page ySlow scores increasing/decreasing a significant amount (tbd) Needs to be fleshed out more, more details to come.
Assignee: nobody → ambient.sounds
Assignee: ambient.sounds → nobody
Target Milestone: --- → 1.0
Attached patch v1 — — Splinter Review
Initial logged in homepage, just the basics.
Attachment #436132 - Flags: review?(jbalogh)
Attachment #436132 - Attachment is patch: true
Attachment #436132 - Attachment mime type: application/octet-stream → text/plain
Comment on attachment 436132 [details] [diff] [review] v1 >+ >+ def score_average(self, days=14): >+ """Aggregates score over the last N days, grouped by day.""" >+ lower_bound = datetime.now() - timedelta(days=days) >+ q = Test.objects.filter(page__in=self.page_set.all(), >+ time__gte=lower_bound) >+ >+ # Add the grouped field to the SELECT for convenience. >+ time_field = 'DATE(%s.time)' % Test._meta.db_table >+ >+ # We're messing with undocumented internals here, so don't cry too hard >+ # if it breaks. The ORM currently turns this into 'GROUP BY DATE(..)'. >+ q.query.group_by = [time_field] You're copying this from somewhere else (I recognize that comment), so I do not approve. > <td>{% grade site.score %}</td> >- <td></td> >- <td></td> >- <td></td> >+ <td> >+ <span class="inlinesparkline"> >+ {% for scores in site.scores %} >+ {{ scores }} >+ {% if not forloop.last %},{% endif %} >+ {% endfor %} Surely there's a join filter for this? >diff --git a/project/views.py b/project/views.py >index bfdf064..f00034b 100644 >--- a/project/views.py >+++ b/project/views.py >@@ -10,11 +10,20 @@ from autoyslow.models import Site > def home(request): > if request.user.is_authenticated(): > template = 'project/home_logged_in.html' >+ sites = request.user.sites.all() >+ for site in sites: >+ scores = [] >+ averages = site.score_average().all() >+ for score in averages: >+ scores.append(score.score) You can probably get this with a values_list. You're doing an extra query per site, which is not great. Can you turn this into one query over all the Sites?
Attachment #436132 - Flags: review?(jbalogh) → review-
Cesium is dead. RESOLVED => EXPIRED
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → WONTFIX
Product: Webtools → Webtools Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: