Anonymous edits have been disabled on the wiki. If you want to contribute please login or create an account.

Difference between revisions of "Home/ask/assignments/Documentation"

From PCGamingWiki, the wiki about fixing PC games
< Home‎ | ask‎ | assignments
m (updated docs)
m (updated docs)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
'''Description'''
 
'''Description'''
 +
{{ii}} '''[{{fullurl:Home|action=purge}} Purge the home page] to refresh the lists.'''
  
This page makes use of [https://www.mediawiki.org/wiki/Extension:Cargo/Querying_data the #cargo_query function] to query data from the <code>Assignments</code> Cargo table (populated by the [[PCGamingWiki:Assignments/Table|the Assignments/Table page]]) which is then transcluded unto [[Home]]. As part of the database query, the query makes use of [https://www.mediawiki.org/wiki/Extension:Cargo/Querying_data#Date_filtering the DATEDIFF() function] to validate if the specified <code>Release Date</code> (also set on the [[PCGamingWiki:Assignments/Table|the Assignments/Table page]]) is between two dates, the first day of the month or the first day of the next month.
+
This page makes use of [https://www.mediawiki.org/wiki/Extension:Cargo/Querying_data the #cargo_query function] along with relevant [https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions##time #time parser function] to query data from the <code>Assignments</code> Cargo table (populated by the [[PCGamingWiki:Assignments/Table|the Assignments/Table page]]) which is then transcluded unto [[Home]]. As part of the database query, the query makes use of [https://www.mediawiki.org/wiki/Extension:Cargo/Querying_data#Date_filtering the DATEDIFF() function] to validate if the specified <code>Release Date</code> (also set on the [[PCGamingWiki:Assignments/Table|the Assignments/Table page]]) is between two dates, the first day of the month or the first day of the next month.
  
 
{{ii}} The two future months listed first are ordered by the release date in ascending order. The bottom past month is ordered in descending order.
 
{{ii}} The two future months listed first are ordered by the release date in ascending order. The bottom past month is ordered in descending order.
 
 
'''Syntax'''
 
 
To add a new month or change what month a section covers, simply make a copy of the syntax below and/or update the relevant code segments:
 
 
<pre><nowiki>
 
    <div class="month-container">
 
        <div class="month">
 
            <p>April</p>
 
        </div>
 
        <table class="pcgwikitable sortable template-infotable" style="max-width: 100%; min-width: 100%; margin: 0 auto">
 
            {{#cargo_query:
 
            tables=Assignments
 
            |fields=Game,Status,Release_Date
 
            |where=_pageName = 'PCGamingWiki:Assignments/Table' AND DATEDIFF(Release_Date, '2019-04-01') >= 0 AND DATEDIFF(Release_Date, '2019-05-01') < 0
 
            |format=template
 
            |template=:Home/ask/assignments/row
 
            |limit=10
 
            |order by=Release_Date ASC
 
            |more results text=
 
            }}
 
        </table>
 
    </div>
 
</nowiki></pre>
 
 
'''Update these places'''
 
{{ii}} ''ISO 8601 format, so <code>YYYY-MM-DD</code>''
 
 
 
<code><nowiki><p>April</p></nowiki></code>
 
* This is the header shown above the table; update to reflect what month the table below it shows.
 
 
 
<code><nowiki>DATEDIFF(Release_Date, '2019-04-01') >= 0</nowiki></code>
 
* This evaluates if the release date of a game is '''after or equal to''' the specified date, so change the <code>2019-04-01</code> part to the '''first day of the month''' that the section should list.
 
* So to show games released in December 2019, <code>2019-04-01</code> would be changed to <code>2019-12-01</code>, so that games released ''after or equal to'' the start of December is included.
 
 
 
<code><nowiki> AND DATEDIFF(Release_Date, '2019-05-01') < 0</nowiki></code>
 
* This evaluates if the release date of a game is '''before''' the specified date, so change the <code>2019-05-01</code> part to the '''first day of the ''next'' month''' that the section should list.
 
* So to show games released in December 2019, <code>2019-05-01</code> would be changed to <code>2020-01-01</code>, so that games released ''before'' the start of the next month is included.
 
 
 
<code><nowiki>order by=Release_Date ASC</nowiki></code>
 
* '''ASC''' = Ascending order; releases are ordered from the first day of the month to the last day of the month.
 
* '''DESC''' = Descending order; releases are ordered from the last day of the month to the first day of the month.
 
* Generally recommended to keep past months ordered in descending order, as it keeps the most recent releases on top, while future months are ordered in ascending order.
 
 
 
'''Notes'''
 
 
<code><nowiki>where=_pageName = 'PCGamingWiki:Assignments/Table'</nowiki></code>
 
* This limits the query to only poll data defined on the [[PCGamingWiki:Assignments/Table]] page. If that page ever moved, this needs to be updated.
 

Latest revision as of 06:49, 1 September 2019

Description

Purge the home page to refresh the lists.

This page makes use of the #cargo_query function along with relevant #time parser function to query data from the Assignments Cargo table (populated by the the Assignments/Table page) which is then transcluded unto Home. As part of the database query, the query makes use of the DATEDIFF() function to validate if the specified Release Date (also set on the the Assignments/Table page) is between two dates, the first day of the month or the first day of the next month.

The two future months listed first are ordered by the release date in ascending order. The bottom past month is ordered in descending order.