Пример #1
0
    def _process(self):
        regforms = (self.event_new.registration_forms
                    .filter(RegistrationForm.publish_registrations_enabled,
                            ~RegistrationForm.is_deleted)
                    .options(subqueryload('registrations').subqueryload('data').joinedload('field_data'))
                    .all())
        if registration_settings.get(self.event, 'merge_registration_forms'):
            tables = [self._merged_participant_list_table()]
        else:
            tables = []
            regforms_dict = {regform.id: regform for regform in regforms if regform.publish_registrations_enabled}
            for form_id in registration_settings.get_participant_list_form_ids(self.event):
                try:
                    regform = regforms_dict.pop(form_id)
                except KeyError:
                    # The settings might reference forms that are not available
                    # anymore (publishing was disabled, etc.)
                    continue
                tables.append(self._participant_list_table(regform))
            # There might be forms that have not been sorted by the user yet
            tables += map(self._participant_list_table, regforms_dict.viewvalues())

        published = bool(RegistrationForm.find(RegistrationForm.publish_registrations_enabled,
                                               RegistrationForm.event_id == int(self.event.id)).count())
        num_participants = sum(len(table['rows']) for table in tables)

        return self.view_class.render_template(
            'display/participant_list.html',
            self.event,
            event=self.event,
            regforms=regforms,
            tables=tables,
            published=published,
            num_participants=num_participants
        )
Пример #2
0
def _get_open_regforms(event):
    if not event.has_feature('registration'):
        return []
    from indico.modules.events.registration.models.forms import RegistrationForm
    return (RegistrationForm.find(RegistrationForm.is_open, event_id=int(event.id))
                            .order_by(db.func.lower(RegistrationForm.title))
                            .all())
Пример #3
0
 def _process(self):
     regforms = RegistrationForm.find_all(RegistrationForm.publish_registrations_enabled,
                                          event_id=int(self.event.id))
     query = (Registration
              .find(Registration.event_id == self.event.id,
                    Registration.state == RegistrationState.complete,
                    RegistrationForm.publish_registrations_enabled,
                    ~RegistrationForm.is_deleted,
                    ~Registration.is_deleted,
                    _join=Registration.registration_form)
              .order_by(db.func.lower(Registration.last_name), db.func.lower(Registration.first_name)))
     registrations = [(reg.get_full_name(), reg.get_personal_data()) for reg in query]
     enabled_pd_fields = {field.personal_data_type for reg in regforms for field in reg.active_fields}
     affiliation_enabled = PersonalDataType.affiliation in enabled_pd_fields
     position_enabled = PersonalDataType.position in enabled_pd_fields
     published = bool(RegistrationForm.find(RegistrationForm.publish_registrations_enabled,
                      RegistrationForm.event_id == int(self.event.id)).count())
     return self.view_class.render_template(
         'display/participant_list.html',
         self.event,
         event=self.event,
         regforms=regforms,
         show_affiliation=affiliation_enabled and any(pd.get('affiliation') for reg, pd in registrations),
         show_position=position_enabled and any(pd.get('position') for reg, pd in registrations),
         registrations=registrations,
         published=published
     )
Пример #4
0
 def _process(self):
     regforms = RegistrationForm.find_all(
         RegistrationForm.publish_registrations_enabled,
         event_id=int(self.event.id))
     query = (Registration.find(
         Registration.event_id == self.event.id,
         RegistrationForm.publish_registrations_enabled,
         ~RegistrationForm.is_deleted,
         ~Registration.is_deleted,
         _join=Registration.registration_form).order_by(
             db.func.lower(Registration.last_name),
             db.func.lower(Registration.first_name)))
     registrations = [(reg.get_full_name(), reg.get_personal_data())
                      for reg in query]
     enabled_pd_fields = {
         field.personal_data_type
         for reg in regforms for field in reg.active_fields
     }
     affiliation_enabled = PersonalDataType.affiliation in enabled_pd_fields
     position_enabled = PersonalDataType.position in enabled_pd_fields
     published = bool(
         RegistrationForm.find(
             RegistrationForm.publish_registrations_enabled,
             RegistrationForm.event_id == int(self.event.id)).count())
     return self.view_class.render_template(
         'display/participant_list.html',
         self.event,
         event=self.event,
         regforms=regforms,
         show_affiliation=affiliation_enabled
         and any(pd.get('affiliation') for reg, pd in registrations),
         show_position=position_enabled
         and any(pd.get('position') for reg, pd in registrations),
         registrations=registrations,
         published=published)
Пример #5
0
def _get_open_regforms(event):
    if not event.has_feature('registration'):
        return []
    from indico.modules.events.registration.models.forms import RegistrationForm
    return (RegistrationForm.find(RegistrationForm.is_open, event_id=int(event.id))
                            .order_by(db.func.lower(RegistrationForm.title))
                            .all())
Пример #6
0
 def _visible_registration(event):
     if not event.has_feature('registration'):
         return False
     if RegistrationForm.find(RegistrationForm.is_scheduled, RegistrationForm.event_id == int(event.id)).count():
         return True
     if not session.user:
         return False
     return bool(Registration.find(Registration.user == session.user,
                                   Registration.event_id == int(event.id),
                                   ~Registration.is_deleted,
                                   ~RegistrationForm.is_deleted,
                                   _join=Registration.registration_form).count())
Пример #7
0
 def _visible_registration(event):
     if not event.has_feature('registration'):
         return False
     if RegistrationForm.find(RegistrationForm.is_scheduled,
                              RegistrationForm.event_id == int(
                                  event.id)).count():
         return True
     if not session.user:
         return False
     return bool(
         Registration.find(Registration.user == session.user,
                           Registration.event_id == int(event.id),
                           ~Registration.is_deleted,
                           ~RegistrationForm.is_deleted,
                           _join=Registration.registration_form).count())
Пример #8
0
    def _process(self):
        regforms = (self.event_new.registration_forms.filter(
            RegistrationForm.publish_registrations_enabled,
            ~RegistrationForm.is_deleted).options(
                subqueryload('registrations').subqueryload('data').joinedload(
                    'field_data')).all())
        if registration_settings.get(self.event, 'merge_registration_forms'):
            tables = [self._merged_participant_list_table()]
        else:
            tables = []
            regforms_dict = {
                regform.id: regform
                for regform in regforms
                if regform.publish_registrations_enabled
            }
            for form_id in registration_settings.get_participant_list_form_ids(
                    self.event):
                try:
                    regform = regforms_dict.pop(form_id)
                except KeyError:
                    # The settings might reference forms that are not available
                    # anymore (publishing was disabled, etc.)
                    continue
                tables.append(self._participant_list_table(regform))
            # There might be forms that have not been sorted by the user yet
            tables += map(self._participant_list_table,
                          regforms_dict.viewvalues())

        published = bool(
            RegistrationForm.find(
                RegistrationForm.publish_registrations_enabled,
                RegistrationForm.event_id == int(self.event.id)).count())
        num_participants = sum(len(table['rows']) for table in tables)

        return self.view_class.render_template(
            'display/participant_list.html',
            self.event,
            event=self.event,
            regforms=regforms,
            tables=tables,
            published=published,
            num_participants=num_participants)
Пример #9
0
 def _checkParams(self):
     self.regform = (
         RegistrationForm.find(id=request.view_args["reg_form_id"], is_deleted=False)
         .options(defaultload("form_items").joinedload("children").joinedload("current_data"))
         .one()
     )
Пример #10
0
 def has_data(self):
     return RegistrationForm.find(title=PARTICIPATION_FORM_TITLE).has_rows()
Пример #11
0
 def has_data(self):
     return bool(RegistrationForm.find(title=PARTICIPATION_FORM_TITLE).count())
Пример #12
0
 def has_data(self):
     return RegistrationForm.find(title=PARTICIPATION_FORM_TITLE).has_rows()
Пример #13
0
 def _visible_participant_list(event):
     if not event.has_feature('registration'):
         return False
     return bool(RegistrationForm.find(RegistrationForm.publish_registrations_enabled,
                                       RegistrationForm.event_id == int(event.id)).count())
Пример #14
0
 def _find_registration_forms(self):
     return RegistrationForm.find(
         ~RegistrationForm.is_deleted,
         RegistrationForm.event_id == int(self.event.id))
Пример #15
0
 def has_data(self):
     return bool(
         RegistrationForm.find(title=PARTICIPATION_FORM_TITLE).count())
Пример #16
0
 def _find_registration_forms(self):
     return RegistrationForm.find(~RegistrationForm.is_deleted,
                                  RegistrationForm.event_id == int(self.event.id))