

@staticmethod
def _get_most_recent_activity_commits(activity_model_cls, activity_ids_list, activity_type, commit_type, delete_commit_message):
    "Gets and returns a list of dicts representing the most recent\n        commits made for each activity represented by each ID provided in the\n        activity_ids_list parameter. These are the latest commits made by users\n        to each activity (that is, it will skip over any automated commits such\n        as those from the Oppia migration bot).\n\n        Args:\n            activity_model_cls: The storage layer object for an activity, such\n                as exp_models.ExplorationModel.\n            activity_ids_list: A list of activity IDs (such as exploration IDS)\n                for which the latest commits will be retrieved.\n            activity_type: The type (string) of activity being referenced, such\n                as 'exploration' or 'collection'.\n            commit_type: This (string) represents the activity update commit\n                type, such as feconf.UPDATE_TYPE_EXPLORATION_COMMIT.\n            delete_commit_message: This (string) represents the commit message\n                to use when an activity is found to be deleted, such as\n                feconf.COMMIT_MESSAGE_EXPLORATION_DELETED.\n\n        Returns:\n            A tuple with two entries:\n                - A list (one entry per activity ID) of dictionaries with the\n                  following keys:\n                    - type: The value of the commit_type argument.\n                    - activity_id: The ID of the activity for this commit.\n                    - activity_title: The title of the activity.\n                    - author_id: The author who made the commit.\n                    - last_update_ms: When the commit was created.\n                    - subject: The commit message, otherwise (if the activity\n                      has been deleted) a message indicating that the activity\n                      was deleted.\n                - A list containing valid activity model instances which are\n                  mappable to feedback threads\n        "
    most_recent_commits = []
    activity_models = activity_model_cls.get_multi(activity_ids_list, include_deleted=True)
    tracked_models_for_feedback = []
    for (ind, activity_model) in enumerate(activity_models):
        if (activity_model is None):
            logging.error(('Could not find %s %s' % (activity_type, activity_ids_list[ind])))
            continue
        latest_manual_commit_version = activity_model.version
        metadata_obj = activity_model_cls.get_snapshots_metadata(activity_model.id, [latest_manual_commit_version], allow_deleted=True)[0]
        while (metadata_obj['committer_id'] == feconf.MIGRATION_BOT_USER_ID):
            latest_manual_commit_version -= 1
            metadata_obj = activity_model_cls.get_snapshots_metadata(activity_model_cls.id, [latest_manual_commit_version], allow_deleted=True)[0]
        most_recent_commits.append({
            'type': commit_type,
            'activity_id': activity_model.id,
            'activity_title': activity_model.title,
            'author_id': metadata_obj['committer_id'],
            'last_updated_ms': metadata_obj['created_on_ms'],
            'subject': (delete_commit_message if activity_model.deleted else metadata_obj['commit_message']),
        })
        if (not activity_model.deleted):
            tracked_models_for_feedback.append(activity_model)
    return (most_recent_commits, tracked_models_for_feedback)

dataset/ETHPy150Open oppia/oppia/core/domain/user_jobs_continuous.py RecentUpdatesMRJobManager._get_most_recent_activity_commits/VarMisuse@142/926 `activity_model`->`activity_model_cls`