Difference between revisions of "Home/ask/assignments/Documentation"
m (removed unnecessary stuff) |
m (updated document) |
||
Line 5: | Line 5: | ||
'''Syntax''' | '''Syntax''' | ||
− | To add a new | + | To add a new month or change what month a section covers, simply make a copy of the syntax below and/or update three specific places where relevant: |
<pre><nowiki> | <pre><nowiki> | ||
Line 29: | Line 29: | ||
'''Update these places''' | '''Update these places''' | ||
− | + | ''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> AND DATEDIFF(Release_Date, '2019-05-01') < 0</nowiki></code> | + | <code><nowiki>where=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. |
Revision as of 07:37, 31 May 2019
Description
This page makes use of the #cargo_query function to query data from the Assignments
Cargo table (populated by the the Assignments page) which is then transcluded unto Home. As part of the database query, the page the DATEDIFF() function to validate if the specified Release Date
(also set on the the Assignments page) is between two dates, the first day of the month or the first day of the next month.
Syntax
To add a new month or change what month a section covers, simply make a copy of the syntax below and/or update three specific places where relevant:
<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=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>
Update these places
ISO 8601 format, so YYYY-MM-DD
<p>April</p>
- This is the header shown above the table; update to reflect what month the table below it shows.
where=DATEDIFF(Release_Date, '2019-04-01') >= 0
- This evaluates if the release date of a game is after or equal to the specified date, so change the
2019-04-01
part to the first day of the month that the section should list. - So to show games released in December 2019,
2019-04-01
would be changed to2019-12-01
, so that games released after or equal to the start of December is included.
AND DATEDIFF(Release_Date, '2019-05-01') < 0
- This evaluates if the release date of a game is before the specified date, so change the
2019-05-01
part to the first day of the next month that the section should list. - So to show games released in December 2019,
2019-05-01
would be changed to2020-01-01
, so that games released before the start of the next month is included.