WIP: Road to 1.0.0 #1

Draft
miguel456 wants to merge 123 commits from develop into master
1 changed files with 2 additions and 15 deletions
Showing only changes of commit 5f6f6f693d - Show all commits

View File

@ -36,20 +36,7 @@ use Illuminate\Support\Facades\Log;
class ApplicationController extends Controller class ApplicationController extends Controller
{ {
private function processOSLinebreaks(array $structuredResponses)
{
$processedResponses = $structuredResponses;
foreach ($structuredResponses as $field)
{
foreach($field as $fieldKey => $fieldData)
{
$originalResponse = $fieldData['response'];
$processedResponses['responses'][$fieldKey]['response'] = str_replace(["\r\n", "\r", "\n"], "<br/>", $$ }
// We can't use nl2br because it preserves the line breaks and doesn't include all line breaks used by othe$ }
return $processedResponses;
}
private function canVote($votes): bool private function canVote($votes): bool
{ {
$allvotes = collect([]); $allvotes = collect([]);
@ -79,7 +66,7 @@ class ApplicationController extends Controller
[ [
'application' => $application, 'application' => $application,
'comments' => $application->comments, 'comments' => $application->comments,
'structuredResponses' => $this->processOSLinebreaks(json_decode($application->response->responseData, true)), 'structuredResponses' => json_decode($application->response->responseData, true),
'formStructure' => $application->response->form, 'formStructure' => $application->response->form,
'vacancy' => $application->response->vacancy, 'vacancy' => $application->response->vacancy,
'canVote' => $this->canVote($application->votes), 'canVote' => $this->canVote($application->votes),