From f6611021a6ec70bc7b3761c7eeb9dc45af80321c Mon Sep 17 00:00:00 2001 From: Anna Date: Wed, 5 Sep 2018 09:45:46 -0400 Subject: [PATCH] fix: show correct pagination information --- html/Searches/Invalid page.html | 1292 +++++++++++++++++++++++++++++++ html/Searches/No results.html | 1292 +++++++++++++++++++++++++++++++ src/logic/search.rs | 8 +- 3 files changed, 2590 insertions(+), 2 deletions(-) create mode 100644 html/Searches/Invalid page.html create mode 100644 html/Searches/No results.html diff --git a/html/Searches/Invalid page.html b/html/Searches/Invalid page.html new file mode 100644 index 0000000..92077ad --- /dev/null +++ b/html/Searches/Invalid page.html @@ -0,0 +1,1292 @@ + + + +Free Companies | FINAL FANTASY XIV, The Lodestone + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + +
+ + +
+ + + + + + +
+ + + +
+ +
+ + + + + + + + + + + + + + +
+ + + + +

Free Company

+ + + +
+ +
+ +
+

Free Company Search

+

Search Results

+ +
+
+
+ +

Data Center / World

+
+ +
+

Active Members

+
+ +
+ + + +

Focus

+
+ +

Seeking

+
+ + +

Active

+
+ +
+

Recruitment

+
+ +
+

Housing

+
+ +
+

Grand Company

+
+
+ +
+
+ + +
Free Company: Elysium| Data Center/World : All| Active Members: All| Focus: Role-playing, Leveling, Casual, Hardcore, Dungeons, Guildhests, Trials, Raids, PvP, Not specified| Seeking: Tank, Healer, DPS, Crafter, Gatherer, Not specified| Active: All| Recruitment: All| Housing: All| Grand Company: Maelstrom, Order of the Twin Adder, Immortal Flames
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
54 Total
+
+
+ + + +

Your search yielded no results.

+ + +
+
+ +
+ + + + +
+ ForumsMog StationOfficial Blog +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + +
+ + +
+ + + + + + + + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + + + + +
+ + + +
+

Community Wall

+ +
+
+

Recent Activity

+ +
+

+ Filter which items are to be displayed below.
+ + * Notifications for standings updates are shared across all Worlds.
+ * Notifications for PvP team formations are shared for all languages.
+ * Notifications for free company formations are shared for all languages. +
+

+ + +
+
Sort by
Data Center / World
Primary language
Displaying
+
+ + +
+
+ + + + + +
+ + + + + + + + + + + + + + +
+ +
+ +
+ + + + + + +
+ +

Cookie Policy

+

This website uses cookies. If you do not wish us to set cookies on your device, please do not use the website. Please read the Square Enix cookies policy for more information. Your use of the website is also subject to the terms in the Square Enix website terms of use and privacy policy and by using the website you are accepting those terms. The Square Enix terms of use, privacy policy and cookies policy can also be found through links at the bottom of the page.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/html/Searches/No results.html b/html/Searches/No results.html new file mode 100644 index 0000000..83a7787 --- /dev/null +++ b/html/Searches/No results.html @@ -0,0 +1,1292 @@ + + + +Free Companies | FINAL FANTASY XIV, The Lodestone + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + +
+ + +
+ + + + + + +
+ + + +
+ +
+ + + + + + + + + + + + + + +
+ + + + +

Free Company

+ + + +
+ +
+ +
+

Free Company Search

+

Search Results

+ +
+
+
+ +

Data Center / World

+
+ +
+

Active Members

+
+ +
+ + + +

Focus

+
+ +

Seeking

+
+ + +

Active

+
+ +
+

Recruitment

+
+ +
+

Housing

+
+ +
+

Grand Company

+
+
+ +
+
+ + +
Free Company: Elysiumlmao| Data Center/World : All| Active Members: All| Focus: Role-playing, Leveling, Casual, Hardcore, Dungeons, Guildhests, Trials, Raids, PvP, Not specified| Seeking: Tank, Healer, DPS, Crafter, Gatherer, Not specified| Active: All| Recruitment: All| Housing: All| Grand Company: Maelstrom, Order of the Twin Adder, Immortal Flames
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
0 Total
+
+
+ + + +

Your search yielded no results.

+ + +
+
+ +
+ + + + +
+ ForumsMog StationOfficial Blog +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + +
+ + +
+ + + + + + + + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + + + + +
+ + + +
+

Community Wall

+ +
+
+

Recent Activity

+ +
+

+ Filter which items are to be displayed below.
+ + * Notifications for standings updates are shared across all Worlds.
+ * Notifications for PvP team formations are shared for all languages.
+ * Notifications for free company formations are shared for all languages. +
+

+ + +
+
Sort by
Data Center / World
Primary language
Displaying
+
+ + +
+
+ + + + + +
+ + + + + + + + + + + + + + +
+ +
+ +
+ + + + + + +
+ +

Cookie Policy

+

This website uses cookies. If you do not wish us to set cookies on your device, please do not use the website. Please read the Square Enix cookies policy for more information. Your use of the website is also subject to the terms in the Square Enix website terms of use and privacy policy and by using the website you are accepting those terms. The Square Enix terms of use, privacy policy and cookies policy can also be found through links at the bottom of the page.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/logic/search.rs b/src/logic/search.rs index 066ac1a..243e374 100644 --- a/src/logic/search.rs +++ b/src/logic/search.rs @@ -32,8 +32,12 @@ crate fn parse_pagination(html: &Html) -> Result { .map_err(Error::InvalidNumber)?; let (total_pages, current_page) = if parse_no_results(html) { - let total_pages = (total_results as f32 / LODESTONE_PER_PAGE).ceil() as u64; - let current_page = 0; + let total_pages = if total_results > 0 { + (total_results as f32 / LODESTONE_PER_PAGE).ceil() as u64 + } else { + 1 + }; + let current_page = if total_results > 0 { 0 } else { 1 }; (total_pages, current_page) } else { let pages_str = crate::logic::plain_parse(&html, &*PAGINATION_PAGES)?;