def get_selected_submissions(self, course, filter_type, selected_tasks, users, aggregations, stype):
        """
        Returns the submissions that have been selected by the admin
        :param course: course
        :param filter_type: users or aggregations
        :param selected_tasks: selected tasks id
        :param users: selected usernames
        :param aggregations: selected aggregations
        :param stype: single or all submissions
        :return:
        """
        if filter_type == "users":
            self._validate_list(users)
            aggregations = list(self.database.aggregations.find({"courseid": course.get_id(),
                                                                 "students": {"$in": users}}))
            # Tweak if not using classrooms : classroom['students'] may content ungrouped users
            aggregations = dict([(username,
                                  aggregation if course.use_classrooms() or (
                                      len(aggregation['groups']) and
                                      username in aggregation['groups'][0]["students"]
                                  ) else None
                                  ) for aggregation in aggregations for username in users])

        else:
            self._validate_list(aggregations)
            aggregations = list(
                self.database.aggregations.find({"_id": {"$in": [ObjectId(cid) for cid in aggregations]}}))

            # Tweak if not using classrooms : classroom['students'] may content ungrouped users
            aggregations = dict([(username,
                                  aggregation if course.use_classrooms() or (
                                      len(aggregation['groups']) and
                                      username in aggregation['groups'][0]["students"]
                                  ) else None
                                  ) for aggregation in aggregations for username in aggregation["students"]])

        if stype == "single":
            user_tasks = list(self.database.user_tasks.find({"username": {"$in": list(aggregations.keys())},
                                                             "taskid": {"$in": selected_tasks},
                                                             "courseid": course.get_id()}))

            submissionsid = [user_task['submissionid'] for user_task in user_tasks if user_task['submissionid'] is not None]
            submissions = list(self.database.submissions.find({"_id": {"$in": submissionsid}}))
        else:
            submissions = list(self.database.submissions.find({"username": {"$in": list(aggregations.keys())},
                                                               "taskid": {"$in": selected_tasks},
                                                               "courseid": course.get_id(),
                                                               "status": {"$in": ["done", "error"]}}))

        return submissions, aggregations
Returns the submissions that have been selected by the admin
        :param course: course
        :param filter_type: users or aggregations
        :param selected_tasks: selected tasks id
        :param users: selected usernames
        :param aggregations: selected aggregations
        :param stype: single or all submissions
        :return: