<commit_before><?php

/**
 * @var \app\models\db\Amendment $amendment
 */

use app\models\db\{Amendment, AmendmentSection, AmendmentSupporter, ISupporter};
use app\components\UrlHelper;
use app\models\sectionTypes\ISectionType;

$motion = $amendment->getMyMotion();

$proposedProcedure = null;
if ($amendment->isProposalPublic() && $amendment->proposalStatus) {
    $proposedProcedure = [
        'status_id' => $amendment->proposalStatus,
        'status_title' => $amendment->getFormattedProposalStatus(true),
        'sections' => [],
    ];
    if ($amendment->hasVisibleAlternativeProposaltext()) {
        $hasProposedChange = true;
        $reference = $amendment->getAlternativeProposaltextReference();
        if ($reference) {
            /** @var Amendment $referenceAmendment */
            $referenceAmendment = $reference['amendment'];
            /** @var Amendment $reference */
            $reference = $reference['modification'];

            /** @var AmendmentSection[] $sections */
            $sections = $reference->getSortedSections(false);
            foreach ($sections as $section) {
                if ($referenceAmendment->id === $amendment->id) {
                    $prefix = Yii::t('amend', 'pprocedure_title_own');
                } else {
                    $prefix = Yii::t('amend', 'pprocedure_title_other') . ' ' . $referenceAmendment->titlePrefix;
                }
                if ($section->getSectionType()->isEmpty()) {
                    continue;
                }
                $proposedProcedure['sections'][] = [
                    'type' => ISectionType::typeIdToApi($section->getSettings()->type),
                    'title' => $prefix . ': ' . $section->getSettings()->title,
                    'html' => $section->getSectionType()->getAmendmentPlainHtml(),
                ];
            }
        }
    }
}
<commit_msg>Bugfix: Proposed procedure in API<commit_after><?php

/**
 * @var \app\models\db\Amendment $amendment
 */

use app\models\db\{Amendment, AmendmentSection, AmendmentSupporter, ISupporter};
use app\components\UrlHelper;
use app\models\sectionTypes\ISectionType;

$motion = $amendment->getMyMotion();

$proposedProcedure = null;
if ($amendment->isProposalPublic() && $amendment->proposalStatus) {
    $proposedProcedure = [
        'status_id' => $amendment->proposalStatus,
        'status_title' => $amendment->getFormattedProposalStatus(true),
        'sections' => [],
    ];
    if ($amendment->hasVisibleAlternativeProposaltext(null)) {
        $hasProposedChange = true;
        $reference = $amendment->getAlternativeProposaltextReference();
        if ($reference) {
            /** @var Amendment $referenceAmendment */
            $referenceAmendment = $reference['amendment'];
            /** @var Amendment $reference */
            $reference = $reference['modification'];

            /** @var AmendmentSection[] $sections */
            $sections = $reference->getSortedSections(false);
            foreach ($sections as $section) {
                if ($referenceAmendment->id === $amendment->id) {
                    $prefix = Yii::t('amend', 'pprocedure_title_own');
                } else {
                    $prefix = Yii::t('amend', 'pprocedure_title_other') . ' ' . $referenceAmendment->titlePrefix;
                }
                if ($section->getSectionType()->isEmpty()) {
                    continue;
                }
                $proposedProcedure['sections'][] = [
                    'type' => ISectionType::typeIdToApi($section->getSettings()->type),
                    'title' => $prefix . ': ' . $section->getSettings()->title,
                    'html' => $section->getSectionType()->getAmendmentPlainHtml(),
                ];
            }
        }
    }
}

{'fraction_non_alphanumeric': 0.15089852008456658, 'fraction_numerical': 0.0, 'mean_word_length': 2.2489270386266096, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3282549', 'n_tokens_mistral': 1053, 'n_tokens_neox': 1009, 'n_words': 154}