Add setting to include transfer hours in calculations (#350)

* Add setting to include transfer hours in calculations

* Add some extra tests to check versions

* A couple of more version test cases
This commit is contained in:
Nabeel S
2019-08-08 12:50:43 -04:00
committed by GitHub
parent ff6ba4c29a
commit a08c9db284
12 changed files with 169 additions and 83 deletions

View File

@@ -179,11 +179,10 @@ class VersionService extends Service
$current_version = $this->cleanVersionString($current_version);
}
$current_version = Version::fromString($current_version);
$latest_version = Version::fromString($this->getLatestVersion());
$latest_version = $this->getLatestVersion();
// Convert to semver
if ($latest_version->isGreaterThan($current_version)) {
if ($this->isGreaterThan($latest_version, $current_version)) {
$this->kvpRepo->save('new_version_available', true);
return true;
}
@@ -191,4 +190,17 @@ class VersionService extends Service
$this->kvpRepo->save('new_version_available', false);
return false;
}
/**
* @param string $version1
* @param string $version2
*
* @return bool If $version1 is greater than $version2
*/
public function isGreaterThan($version1, $version2): bool
{
$version1 = Version::fromString($version1);
$version2 = Version::fromString($version2);
return $version1->isGreaterThan($version2);
}
}