Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix survey export: Remove Excel in favor of Exportables #1017

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

Maximilian-Staab
Copy link

The exporting of survey results is currently using a no longer supported call to Excel::create. Both AttendeesExport and OrdersExport already exist and are used by their respective controller.

This fix implements the same functionality for surveys.

Should fix #1015

This is my first time using php in any meaningful capacity, please be gentle.

Copy link

@ghoussay ghoussay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have applied your changes but got a timeout by php (maximum execution time...)
I checked your query and it appears it combines way too much lines. (result arround 600000 lignes for 7 attendees and 6 questions).
I changed the query like this (should join attendees table on attendee id) :

    public function query()
    {
        $query = QuestionAnswer::query()->where('question_answers.event_id', $this->event_id);
        $query->select([
            'attendees.first_name',
            'attendees.last_name',
            'attendees.email',
            'questions.title',
            'question_answers.answer_text',
        ])
            ->join('attendees', 'attendees.id', '=', 'question_answers.attendee_id')
            ->join('questions', 'questions.id', '=', 'question_answers.question_id');
        return $query;
    }

@justynpride
Copy link
Contributor

Perfect, I needed this. Now to get the questions editable and viewable on the attendee record and we have a user friendly system

@gaforester
Copy link

I updated to 2.8 thinking this might be fixed. Nope. Not sure why this was never merged but it works great. I just changed the attendees join line to ->join('attendees', 'attendees.id', '=', 'question_answers.attendee_id') and it works perfect. Hopefully this can get pushed to a future release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Exporting answers to surveys in any format fails
6 participants