<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3AUSN_fleet_totals</id>
	<title>Module:USN fleet totals - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3AUSN_fleet_totals"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:USN_fleet_totals&amp;action=history"/>
	<updated>2026-05-13T14:33:56Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:USN_fleet_totals&amp;diff=147406&amp;oldid=prev</id>
		<title>imported&gt;Trappist the monk at 17:02, 1 October 2022</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:USN_fleet_totals&amp;diff=147406&amp;oldid=prev"/>
		<updated>2022-10-01T17:02:18Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local data = mw.loadData (&amp;#039;Module:USN fleet totals/data&amp;#039;);						-- get the detailed list of ship types and their counts, the grand total of active and reserve ships, and the total planned ships&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; R O U N D &amp;gt;--------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
rounds &amp;lt;count&amp;gt; to nearest multiple of 5.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function round (count)&lt;br /&gt;
	if 0 == count % 5 then&lt;br /&gt;
		return count;															-- &amp;lt;count&amp;gt; is xx0, xx5 so return unmolested&lt;br /&gt;
	elseif 2.5 &amp;gt; (count % 5) then&lt;br /&gt;
		return count - (count % 5);												-- &amp;lt;count&amp;gt; is xx1, xx2 so return xx0&lt;br /&gt;
	else&lt;br /&gt;
		return count + (5 - (count % 5));										-- &amp;lt;count&amp;gt; is xx3, xx4 so return xx5&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; U S N _ F L E E T _ T O T A L S &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
implements {{USN fleet totals}}&lt;br /&gt;
&lt;br /&gt;
This function returns one of three values according to the text sting in {{{1}}} (frame.args[1]):&lt;br /&gt;
	active – the &amp;#039;grand total&amp;#039; (active and reserved fleets) rounded to the nearest multiple of 5					-- {{USN fleet totals|active}}&lt;br /&gt;
	planned – the &amp;#039;planned total&amp;#039; (ships under construction or on order) rounded to the nearest multiple of 5		-- {{USN fleet totals|planned}}&lt;br /&gt;
	&amp;lt;anything or nothing&amp;gt; – the long string of fleet totals created by Module:USN fleet totals						-- {{USN fleet totals}}&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function USN_fleet_totals (frame)&lt;br /&gt;
	if &amp;#039;active&amp;#039; == frame.args[1] then											-- number of active and reseved fleet ships&lt;br /&gt;
		return round (data.grand_total);										-- round to nearest multiple of 5&lt;br /&gt;
	elseif &amp;#039;planned&amp;#039; == frame.args[1] then										-- under of under construction and on-order ships&lt;br /&gt;
		return round (data.planned_total);										-- round to nearest multiple of 5&lt;br /&gt;
	else																		-- {{{1}}} is anything else&lt;br /&gt;
		return data.fleet_totals_str;											-- return the detailed fleet totals&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E X P O R T S &amp;gt;----------------------------------------------------------------&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
return &lt;br /&gt;
	{&lt;br /&gt;
	USN_fleet_totals = USN_fleet_totals,&lt;br /&gt;
	}&lt;/div&gt;</summary>
		<author><name>imported&gt;Trappist the monk</name></author>
	</entry>
</feed>