f3dbb6069630079f5f82d3325f8129b1ee2ecaec,general/management/commands/report_count_statuses.py,Command,handle,#Command#,56

Before Change


        if not options["skip-downloads"]:
            potential_user_ids = set()
            potential_user_ids.update(
                Download.objects.all().values_list("user_id", flat=True))  // Add ids of downloaders
            potential_user_ids.update(PackDownload.objects.all().values_list("user_id", flat=True))
            total = len(potential_user_ids)

After Change


                report_progress("Checking number of downloaded sounds in %i users... %.2f%%", total, count)

            // Look at number of pack downloads for all active users (see note above)
            for count, user in enumerate(User.objects.filter(is_active=True).select_related("profile").
                                         annotate(real_num_pack_downloads=Count("pack_downloads"),).iterator()):
                user_profile = user.profile

                real_num_pack_downloads = user.real_num_pack_downloads
                if real_num_pack_downloads != user_profile.num_pack_downloads:
                    mismatches_report["User.num_pack_downloads"] += 1
                    mismatches_object_ids["User.num_pack_downloads"].append(user.id)
                    user_profile.num_pack_downloads = real_num_pack_downloads

                    if not options["no-changes"]:
                        user_profile.save()

                report_progress("Checking number of downloaded packs in %i users... %.2f%%", total, count)

        console_logger.info("Number of mismatched counts: ")
        console_logger.info("\n" + pprint.pformat(mismatches_report))
        console_logger.info("\n" + pprint.pformat(mismatches_object_ids))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 2

Instances


Project Name: MTG/freesound
Commit Name: f3dbb6069630079f5f82d3325f8129b1ee2ecaec
Time: 2018-05-24
Author: frederic.font@upf.edu
File Name: general/management/commands/report_count_statuses.py
Class Name: Command
Method Name: handle


Project Name: AlexsLemonade/refinebio
Commit Name: 952ac41dc0ba88dfc66cd948a0de2f23ccb4a2df
Time: 2020-08-13
Author: willvauclain.dev@gmail.com
File Name: common/data_refinery_common/models/experiment.py
Class Name: Experiment
Method Name: get_sample_metadata_fields


Project Name: AlexsLemonade/refinebio
Commit Name: 8bc46bda10949ec121c784fa0dd70deea12438f9
Time: 2019-08-22
Author: arielsvn@gmail.com
File Name: foreman/data_refinery_foreman/foreman/management/commands/rerun_salmon_old_samples.py
Class Name:
Method Name: update_salmon_versions