Skip to content

Commit

Permalink
Added free games ranking in lieu of "Free to Play" tag.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilge committed Jun 1, 2024
1 parent 5f3881a commit eb46f78
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/Page/HomePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Doctrine\DBAL\Connection;
use ScriptFUSION\Steam250\SiteGenerator\Database\Queries;
use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\DiscountRanking;
use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\FreeRanking;
use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\HiddenGemsRanking;
use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\MostPlayedRanking;
use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\RollingWeekRanking;
Expand Down Expand Up @@ -76,7 +77,7 @@ public static function getRankings(): array
MostPlayedRanking::class,
UsdUnder5Ranking::class,
DiscountRanking::class,
'free_to_play',
FreeRanking::class,
'sexual_content',
'co-op',
'rpg',
Expand Down
23 changes: 23 additions & 0 deletions src/Ranking/Impl/FreeRanking.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);

namespace ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl;

use Doctrine\DBAL\Query\QueryBuilder;
use ScriptFUSION\Steam250\SiteGenerator\Ranking\RankingDependencies;

class FreeRanking extends DefaultRanking
{
public function __construct(RankingDependencies $dependencies)
{
parent::__construct($dependencies, 'price/free');

$this->setTitle('Free Games');
$this->setDescription('Top 250 best free of charge games on Steam, according to gamer reviews.');
}

public function customizeQuery(QueryBuilder $builder): void
{
$builder->andWhere('app.free = 1');
}
}
5 changes: 4 additions & 1 deletion src/Ranking/RankingName.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\DeveloperRanking;
use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\DiscountRanking;
use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\DlcRanking;
use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\FreeRanking;
use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\HiddenGemsRanking;
use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\HiddenNovelsRanking;
use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\Linux250Ranking;
Expand All @@ -27,7 +28,6 @@
use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\SteamDeckPlayableRanking;
use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\SteamDeckVerifiedRanking;
use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\Top250Ranking;
use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\TrendRanking;
use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\Usd10To15Ranking;
use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\Usd5To10Ranking;
use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\UsdOver15Ranking;
Expand All @@ -42,6 +42,7 @@ final class RankingName extends AbstractEnumeration
public const BOTTOM_100 = 'BOTTOM_100';
public const DLC = 'DLC';
public const DISCOUNT = 'DISCOUNT';
public const FREE = 'FREE';
public const USD_UNDER_5 = 'USD_UNDER_5';
public const USD5_10 = 'USD5_10';
public const USD10_15 = 'USD10_15';
Expand Down Expand Up @@ -73,6 +74,7 @@ final class RankingName extends AbstractEnumeration
self::BOTTOM_100 => Bottom100Ranking::class,
self::DLC => DlcRanking::class,
self::DISCOUNT => DiscountRanking::class,
self::FREE => FreeRanking::class,
self::USD_UNDER_5 => UsdUnder5Ranking::class,
self::USD5_10 => Usd5To10Ranking::class,
self::USD10_15 => Usd10To15Ranking::class,
Expand Down Expand Up @@ -105,6 +107,7 @@ final class RankingName extends AbstractEnumeration
self::BOTTOM_100 => 'b100',
self::DLC => 'dlc',
self::DISCOUNT => 'discount',
self::FREE => 'free',
self::USD_UNDER_5 => 'u5',
self::USD5_10 => '5-10',
self::USD10_15 => '10-15',
Expand Down
2 changes: 1 addition & 1 deletion template/adult.twig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends 'layout/ranking.twig' %}

{% block title %}Top 250 best Adult Steam games{% endblock %}
{% block title %}Top 250 best Adult Steam Games{% endblock %}
{% block heading %}Adult 250{% endblock %}

{% block content %}
Expand Down
2 changes: 1 addition & 1 deletion template/home.twig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{% set url = ranking.ranking.url ?? (id ~ ext) %}
<section class="top10">
<header>
{% set group = id in ['price/under5', 'discounts', 'tag/free_to_play'] ? 'budget'
{% set group = id in ['price/under5', 'discounts', 'price/free'] ? 'budget'
: id[:4] == 'tag/' ? 'tag'
: ''
%}
Expand Down
2 changes: 1 addition & 1 deletion template/layout/template.twig
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
<a>Price</a>
<ol>
<li><a href="/discounts{{ ext }}">Top 250 Discounts</a>
<li><a href="/tag/free_to_play{{ ext }}">Free Games</a>
<li><a href="/price/free{{ ext }}">Free Games</a>
<li><a href="/price/under5{{ ext }}">Games Under $5</a>
<li><a href="/price/5-10{{ ext }}">Games $5&ndash;10</a>
<li><a href="/price/10-15{{ ext }}">Games $10&ndash;15</a>
Expand Down
8 changes: 8 additions & 0 deletions template/price/free.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% extends 'layout/ranking.twig' %}

{% block title %}Top 250 best Free Steam Games{% endblock %}
{% block heading %}Free 250{% endblock %}

{% block content %}
<p>{{ ranking.description }}</p>
{% endblock %}

0 comments on commit eb46f78

Please sign in to comment.