Skip to content

Commit

Permalink
Fixed Changed the failing number to -1 (it would output an error if y…
Browse files Browse the repository at this point in the history
…ou have an 0 ping)
  • Loading branch information
gnmyt committed May 13, 2022
1 parent 73b65f7 commit 83f2cc1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion client/src/HelperFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function generateRelativeTime(created) {
export function getIconBySpeed(current, optional, higherIsBetter) {
let speed = Math.floor((current / optional) * 100);

if (current === 0) return "error";
if (current === -1) return "error";

if (higherIsBetter) {
if (speed >= 75) return "green";
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/LatestTestComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function LatestTestComponent() {
<h2 className="container-text">Ping<span className="container-subtext">ms</span></h2>
</div>
<div className="container-main">
<h2>{latest.ping === 0 ? "Test" : latest.ping}</h2>
<h2>{latest.ping === -1 ? "Test" : latest.ping}</h2>
</div>
</div>

Expand All @@ -61,7 +61,7 @@ function LatestTestComponent() {
<h2 className="container-text">Download<span className="container-subtext">Mbit/s</span></h2>
</div>
<div className="container-main">
<h2>{latest.download === 0 ? "schlug" : latest.download}</h2>
<h2>{latest.download === -1 ? "schlug" : latest.download}</h2>
</div>
</div>

Expand All @@ -76,7 +76,7 @@ function LatestTestComponent() {
<h2 className="container-text">Upload<span className="container-subtext">Mbit/s</span></h2>
</div>
<div className="container-main">
<h2>{latest.upload === 0 ? "fehl!" : latest.upload}</h2>
<h2>{latest.upload === -1 ? "fehl!" : latest.upload}</h2>
</div>
</div>

Expand Down
6 changes: 3 additions & 3 deletions client/src/components/SpeedtestComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ class Speedtest extends Component {
</div>
<div className="speedtest-row">
<FontAwesomeIcon icon={this.props.ping !== 0 ? faPingPongPaddleBall : faClose} className={"speedtest-icon icon-" + this.props.pingLevel}/>
<h2 className="speedtest-text">{this.props.ping === 0 ? "" : this.props.ping}</h2>
<h2 className="speedtest-text">{this.props.ping === -1 ? "" : this.props.ping}</h2>
</div>
<div className="speedtest-row">
<FontAwesomeIcon icon={this.props.down !== 0 ? faArrowDown : faClose} className={"speedtest-icon icon-" + this.props.downLevel} />
<h2 className="speedtest-text">{this.props.down === 0 ? "" : this.props.down}</h2>
<h2 className="speedtest-text">{this.props.down === -1 ? "" : this.props.down}</h2>
</div>
<div className="speedtest-row">
<FontAwesomeIcon icon={this.props.up !== 0 ? faArrowUp : faClose} className={"speedtest-icon icon-" + this.props.upLevel}/>
<h2 className="speedtest-text">{this.props.up === 0 ? "" : this.props.up}</h2>
<h2 className="speedtest-text">{this.props.up === -1 ? "" : this.props.up}</h2>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion server/tasks/speedtest.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports.create = async () => {
console.log(`Test #${testResult} was executed successfully. 🏓 ${ping}${download}️ ⬆ ${upload}️`);
createRecommendations().then(() => "");
} catch (e) {
let testResult = tests.create(0, 0, 0);
let testResult = tests.create(-1, -1, -1);
console.log(`Test #${testResult} was not executed successfully. Please try reconnecting to the internet or restarting the software.`);
}
isRunning = false;
Expand Down

2 comments on commit 83f2cc1

@pavl21
Copy link
Contributor

@pavl21 pavl21 commented on 83f2cc1 May 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sehr gut 👍. Hoffen wir mal, das es keine Speedtests geben wird, die eine Schallmauer des Pings durchbrechen können. :D

@gnmyt
Copy link
Owner Author

@gnmyt gnmyt commented on 83f2cc1 May 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙈

Please sign in to comment.