ad58b661aaee955bf8dc8086d805d56485f8c53a,sounds/views.py,,sounds,#Any#,108
Before Change
latest_sounds = Sound.objects.latest_additions(num_sounds=5, period_days=2)
latest_packs = Pack.objects.select_related().filter(num_sounds__gt=0).exclude(is_deleted=True).order_by("-last_updated")[0:20]
last_week = get_n_weeks_back_datetime(n_weeks=1)
popular_sound_ids = [snd.id for snd in Sound.objects.filter(
Q(moderation_date__gte=last_week) | Q(created__gte=last_week)).order_by("-num_downloads")[0:5]]
popular_sounds = Sound.objects.ordered_ids(popular_sound_ids)
popular_packs = Pack.objects.filter(created__gte=last_week).exclude(is_deleted=True).order_by("-num_downloads")[0:5]
random_sound_id = get_sound_of_the_day_id()
if random_sound_id:
random_sound = Sound.objects.bulk_query_id([random_sound_id])[0]
After Change
latest_sounds = Sound.objects.latest_additions(num_sounds=5, period_days=2)
latest_packs = Pack.objects.select_related().filter(num_sounds__gt=0).exclude(is_deleted=True).order_by("-last_updated")[0:20]
last_week = get_n_weeks_back_datetime(n_weeks=1)
popular_sounds = Sound.public.select_related("license", "user") \
.annotate(greatest_date=Greatest("created", "moderation_date")) \
.filter(greatest_date__gte=last_week).order_by("-num_downloads")[0:5]
popular_packs = Pack.objects.select_related("user").filter(created__gte=last_week).exclude(is_deleted=True).order_by("-num_downloads")[0:5]
random_sound_id = get_sound_of_the_day_id()
if random_sound_id:
random_sound = Sound.objects.bulk_query_id([random_sound_id])[0]
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances
Project Name: MTG/freesound
Commit Name: ad58b661aaee955bf8dc8086d805d56485f8c53a
Time: 2019-07-24
Author: alastair.porter@upf.edu
File Name: sounds/views.py
Class Name:
Method Name: sounds
Project Name: okfn-brasil/serenata-de-amor
Commit Name: a460674c772c2c0685148c8eb94b1743afea71d5
Time: 2017-09-28
Author: cuducos@users.noreply.github.com
File Name: jarbas/dashboard/admin.py
Class Name: ReimbursementModelAdmin
Method Name: get_search_results
Project Name: AlexsLemonade/refinebio
Commit Name: 86fa89f0f50e153d625108d93f1f9eb8ee59719e
Time: 2019-11-01
Author: davidsmejia@gmail.com
File Name: workers/data_refinery_workers/processors/create_compendia.py
Class Name:
Method Name: _create_result_objects