This commit is contained in:
13
PROJECT.org
13
PROJECT.org
@ -88,7 +88,7 @@ fetching and simple saving.
|
||||
*** Metadata sources
|
||||
**** Scraper
|
||||
|
||||
* Backlog [1/21] :vrobbler:project:personal:
|
||||
* Backlog [2/22] :vrobbler:project:personal:
|
||||
** TODO [#C] Create small utility to clean up tracks scrobbled with wonky playback times :bug:music:scrobbles:
|
||||
:PROPERTIES:
|
||||
:ID: 702462cf-d54b-48c6-8a7c-78b8de751deb
|
||||
@ -590,7 +590,16 @@ We should rename `email_scrobble_board_game` to reflect the fact that it's just
|
||||
a helper method to create board game scrobbles given a json blob. It's
|
||||
independent of the email flow it was originally creatdd for
|
||||
|
||||
** DONE [#A] Add a trend around moods :moods:trends:
|
||||
** DONE [#A] Remove all-time trends :trends:
|
||||
:PROPERTIES:
|
||||
:ID: 53b231d1-7677-8cd3-1d88-dae110aba1e6
|
||||
:END:
|
||||
|
||||
*** Description
|
||||
|
||||
All time trends take forever to calculate and don't provide too much data
|
||||
|
||||
** DONE [#B] Add a trend around moods :moods:trends:
|
||||
:PROPERTIES:
|
||||
:ID: fba3f4ae-8f97-ee0b-e762-31630884518a
|
||||
:END:
|
||||
|
||||
@ -8,7 +8,6 @@ PERIOD_CHOICES = [
|
||||
("last_30", "Last 30 days"),
|
||||
("last_90", "Last 90 days"),
|
||||
("last_year", "Last year"),
|
||||
("all_time", "All time"),
|
||||
]
|
||||
|
||||
|
||||
@ -18,7 +17,7 @@ class TrendResult(TimeStampedModel):
|
||||
period = models.CharField(
|
||||
max_length=20,
|
||||
choices=PERIOD_CHOICES,
|
||||
default="all_time",
|
||||
default="last_30",
|
||||
)
|
||||
computed_at = models.DateTimeField(auto_now_add=True)
|
||||
data = models.JSONField(default=dict)
|
||||
|
||||
@ -10,7 +10,6 @@ PERIOD_DAYS = {
|
||||
"last_30": 30,
|
||||
"last_90": 90,
|
||||
"last_year": 365,
|
||||
"all_time": None,
|
||||
}
|
||||
|
||||
PERIOD_LABELS = dict(PERIOD_CHOICES)
|
||||
@ -24,8 +23,10 @@ TIME_BOUND_TRENDS = {
|
||||
"mood-streaks",
|
||||
"mood-trajectory",
|
||||
"mood-weather",
|
||||
"peak-hours",
|
||||
"reading-pace-vs-activity",
|
||||
"trending-up",
|
||||
"weekly-rhythm",
|
||||
}
|
||||
|
||||
TREND_PERIOD_OVERRIDES = {
|
||||
@ -37,9 +38,7 @@ def get_supported_periods(trend_slug):
|
||||
if trend_slug in TREND_PERIOD_OVERRIDES:
|
||||
slugs = TREND_PERIOD_OVERRIDES[trend_slug]
|
||||
return {s: PERIOD_LABELS[s] for s in slugs}
|
||||
if trend_slug in TIME_BOUND_TRENDS:
|
||||
return dict(PERIOD_LABELS)
|
||||
return {"all_time": PERIOD_LABELS["all_time"]}
|
||||
return dict(PERIOD_LABELS)
|
||||
|
||||
|
||||
def get_period_days(period):
|
||||
@ -66,7 +65,7 @@ def get_period_nav(current_period, trend_slug):
|
||||
return prev_period, next_period
|
||||
|
||||
|
||||
def compute_and_save_trend(user, slug, period="all_time"):
|
||||
def compute_and_save_trend(user, slug, period="last_30"):
|
||||
"""Compute a single trend for a given period and persist the result.
|
||||
|
||||
Returns elapsed seconds on success, raises on failure.
|
||||
|
||||
@ -111,7 +111,7 @@ class TrendDetailView(LoginRequiredMixin, TemplateView):
|
||||
ctx["trend_not_found"] = True
|
||||
return ctx
|
||||
|
||||
period = self.request.GET.get("period", "all_time")
|
||||
period = self.request.GET.get("period", "last_30")
|
||||
|
||||
meta = TREND_METADATA.get(slug, {})
|
||||
ctx["trend"] = {
|
||||
|
||||
Reference in New Issue
Block a user