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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user