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

Hidden buildings/techs are partly shown in spy report #553

Open
yaench opened this issue Oct 3, 2022 · 0 comments
Open

Hidden buildings/techs are partly shown in spy report #553

yaench opened this issue Oct 3, 2022 · 0 comments

Comments

@yaench
Copy link

yaench commented Oct 3, 2022

If a building or technology is set to building_show = 0 / tech_show = 0, it appears in spy reports anyway, but only the level of the building/tech without the name:

image

macros.html.twig

{% macro dataTable(entries, names) %}
    <table>
        {% for id, count in entries %}
            <tr>
                <td>{{ names[id] }}</td>
                <td style="text-align:right;">{{ formatNumber(count) }}</td>
            </tr>
        {% endfor %}
    </table>
{% endmacro %}

BuildingDataRepository.php

public function getBuilding(int $buildingId): ?Building
    {
        $data = $this->createQueryBuilder()
            ->select('b.*')
            ->from('buildings', 'b')
            ->andWhere('b.building_id = :building_id')
            ->andWhere('b.building_show=1')
            ->setParameter('building_id', $buildingId)
            ->fetchAssociative();

        return $data !== false ? new Building($data) : null;
    }

For me, it looks like the macro is showing the formatNumber(count) regardless if names[id] is empty or not. Easiest fix would probably be to just don't write hidden buildings and technologies to the database.

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

No branches or pull requests

1 participant