update 2023-07-02 09:34:21
This commit is contained in:
parent
775786ed42
commit
8820489aca
@ -22,6 +22,7 @@ class Watcher << (F,LightGreen) >> #Green {
|
||||
# string $today
|
||||
# ?object $verse
|
||||
+ __construct(Load $load, Insert $insert, ...)
|
||||
+ isNew() : bool
|
||||
+ api(string $translation, int $book, ...) : bool
|
||||
+ getNextChapter(string $translation, int $book, ...) : ?int
|
||||
+ getPreviousChapter(int $chapter, bool $force = false) : ?int
|
||||
@ -54,7 +55,14 @@ note right of Watcher::__construct
|
||||
Verses $verses
|
||||
end note
|
||||
|
||||
note left of Watcher::api
|
||||
note left of Watcher::isNew
|
||||
The see if new chapters was installed, and therefore new
|
||||
|
||||
since: 2.0.1
|
||||
return: bool
|
||||
end note
|
||||
|
||||
note right of Watcher::api
|
||||
Watching that the local Database and API is in sync
|
||||
|
||||
since: 2.0.1
|
||||
@ -66,7 +74,7 @@ note left of Watcher::api
|
||||
int $chapter
|
||||
end note
|
||||
|
||||
note right of Watcher::getNextChapter
|
||||
note left of Watcher::getNextChapter
|
||||
Get the next chapter
|
||||
|
||||
since: 2.0.1
|
||||
@ -79,21 +87,21 @@ note right of Watcher::getNextChapter
|
||||
bool $force = false
|
||||
end note
|
||||
|
||||
note left of Watcher::getPreviousChapter
|
||||
note right of Watcher::getPreviousChapter
|
||||
Get the previous chapter
|
||||
|
||||
since: 2.0.1
|
||||
return: ?int
|
||||
end note
|
||||
|
||||
note right of Watcher::getLastChapter
|
||||
note left of Watcher::getLastChapter
|
||||
Get the last chapter of a book
|
||||
|
||||
since: 2.0.1
|
||||
return: ?int
|
||||
end note
|
||||
|
||||
note left of Watcher::getNextBook
|
||||
note right of Watcher::getNextBook
|
||||
Get the next book
|
||||
|
||||
since: 2.0.1
|
||||
@ -105,7 +113,7 @@ note left of Watcher::getNextBook
|
||||
int $try
|
||||
end note
|
||||
|
||||
note right of Watcher::getPreviousBook
|
||||
note left of Watcher::getPreviousBook
|
||||
Get the previous book
|
||||
|
||||
since: 2.0.1
|
||||
@ -117,21 +125,21 @@ note right of Watcher::getPreviousBook
|
||||
int $try
|
||||
end note
|
||||
|
||||
note left of Watcher::translation
|
||||
note right of Watcher::translation
|
||||
Get Translation Hash Value
|
||||
|
||||
since: 2.0.1
|
||||
return: ?string
|
||||
end note
|
||||
|
||||
note right of Watcher::book
|
||||
note left of Watcher::book
|
||||
Get Book Hash Value
|
||||
|
||||
since: 2.0.1
|
||||
return: ?string
|
||||
end note
|
||||
|
||||
note left of Watcher::chapter
|
||||
note right of Watcher::chapter
|
||||
Get Chapter Hash Value
|
||||
|
||||
since: 2.0.1
|
||||
@ -143,7 +151,7 @@ note left of Watcher::chapter
|
||||
int $chapter
|
||||
end note
|
||||
|
||||
note right of Watcher::verses
|
||||
note left of Watcher::verses
|
||||
Load verses if not in local database
|
||||
|
||||
since: 2.0.1
|
||||
@ -155,7 +163,7 @@ note right of Watcher::verses
|
||||
int $chapter
|
||||
end note
|
||||
|
||||
note left of Watcher::update
|
||||
note right of Watcher::update
|
||||
Trigger the update of the verses of a translation-book-chapter
|
||||
|
||||
since: 2.0.1
|
||||
@ -167,14 +175,14 @@ note left of Watcher::update
|
||||
int $chapter
|
||||
end note
|
||||
|
||||
note right of Watcher::getVerse
|
||||
note left of Watcher::getVerse
|
||||
Get a verse text from the API array of verses
|
||||
|
||||
since: 2.0.1
|
||||
return: ?object
|
||||
end note
|
||||
|
||||
note left of Watcher::updateHash
|
||||
note right of Watcher::updateHash
|
||||
Trigger the update of a chapter hash value
|
||||
|
||||
since: 2.0.1
|
||||
@ -187,14 +195,14 @@ note left of Watcher::updateHash
|
||||
string $hash
|
||||
end note
|
||||
|
||||
note right of Watcher::hold
|
||||
note left of Watcher::hold
|
||||
Check if its time to match the API hash
|
||||
|
||||
since: 2.0.1
|
||||
return: bool
|
||||
end note
|
||||
|
||||
note left of Watcher::bump
|
||||
note right of Watcher::bump
|
||||
Bump the checking time
|
||||
|
||||
since: 2.0.1
|
||||
|
@ -143,6 +143,17 @@ final class Watcher
|
||||
$this->today = (new Date())->toSql();
|
||||
}
|
||||
|
||||
/**
|
||||
* The see if new chapters was installed, and therefore new
|
||||
*
|
||||
* @return bool true if is new
|
||||
* @since 2.0.1
|
||||
*/
|
||||
public function isNew(): bool
|
||||
{
|
||||
return $this->fresh;
|
||||
}
|
||||
|
||||
/**
|
||||
* Watching that the local Database and API is in sync
|
||||
*
|
||||
@ -176,7 +187,7 @@ final class Watcher
|
||||
// load the verses if not found
|
||||
if ($this->verses($translation, $book, $chapter))
|
||||
{
|
||||
if ($this->fresh || $this->hold())
|
||||
if ($this->isNew() || $this->hold())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -216,7 +227,7 @@ final class Watcher
|
||||
// we load the next chapter
|
||||
$next = $chapter + 1;
|
||||
// check if this books has this next chapter
|
||||
if (($force || !$this->fresh) && $this->load->value(
|
||||
if (($force || !$this->isNew()) && $this->load->value(
|
||||
['abbreviation' => $translation, 'book_nr' => $book, 'chapter' => $next],
|
||||
'sha', 'chapter'
|
||||
))
|
||||
@ -240,7 +251,7 @@ final class Watcher
|
||||
{
|
||||
// we load the previous chapter
|
||||
$previous = $chapter - 1;
|
||||
if (($force || !$this->fresh) && $previous > 0)
|
||||
if (($force || !$this->isNew()) && $previous > 0)
|
||||
{
|
||||
return $previous;
|
||||
}
|
||||
|
@ -112,6 +112,17 @@
|
||||
$this->today = (new Date())->toSql();
|
||||
}
|
||||
|
||||
/**
|
||||
* The see if new chapters was installed, and therefore new
|
||||
*
|
||||
* @return bool true if is new
|
||||
* @since 2.0.1
|
||||
*/
|
||||
public function isNew(): bool
|
||||
{
|
||||
return $this->fresh;
|
||||
}
|
||||
|
||||
/**
|
||||
* Watching that the local Database and API is in sync
|
||||
*
|
||||
@ -145,7 +156,7 @@
|
||||
// load the verses if not found
|
||||
if ($this->verses($translation, $book, $chapter))
|
||||
{
|
||||
if ($this->fresh || $this->hold())
|
||||
if ($this->isNew() || $this->hold())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -185,7 +196,7 @@
|
||||
// we load the next chapter
|
||||
$next = $chapter + 1;
|
||||
// check if this books has this next chapter
|
||||
if (($force || !$this->fresh) && $this->load->value(
|
||||
if (($force || !$this->isNew()) && $this->load->value(
|
||||
['abbreviation' => $translation, 'book_nr' => $book, 'chapter' => $next],
|
||||
'sha', 'chapter'
|
||||
))
|
||||
@ -209,7 +220,7 @@
|
||||
{
|
||||
// we load the previous chapter
|
||||
$previous = $chapter - 1;
|
||||
if (($force || !$this->fresh) && $previous > 0)
|
||||
if (($force || !$this->isNew()) && $previous > 0)
|
||||
{
|
||||
return $previous;
|
||||
}
|
||||
|
@ -51,15 +51,6 @@ class Table extends BaseTable implements Tableinterface
|
||||
],
|
||||
],
|
||||
'note' => [
|
||||
'linker' => [
|
||||
'name' => 'linker',
|
||||
'label' => 'COM_GETBIBLE_NOTE_LINKER_LABEL',
|
||||
'type' => 'linkers',
|
||||
'title' => false,
|
||||
'list' => 'notes',
|
||||
'store' => NULL,
|
||||
'tab_name' => 'Details',
|
||||
],
|
||||
'book_nr' => [
|
||||
'name' => 'book_nr',
|
||||
'label' => 'COM_GETBIBLE_NOTE_BOOK_NR_LABEL',
|
||||
@ -69,19 +60,10 @@ class Table extends BaseTable implements Tableinterface
|
||||
'store' => NULL,
|
||||
'tab_name' => 'Details',
|
||||
],
|
||||
'chapter' => [
|
||||
'name' => 'chapter',
|
||||
'label' => 'COM_GETBIBLE_NOTE_CHAPTER_LABEL',
|
||||
'type' => 'number',
|
||||
'title' => false,
|
||||
'list' => 'notes',
|
||||
'store' => NULL,
|
||||
'tab_name' => 'Details',
|
||||
],
|
||||
'verse' => [
|
||||
'name' => 'verse',
|
||||
'label' => 'COM_GETBIBLE_NOTE_VERSE_LABEL',
|
||||
'type' => 'number',
|
||||
'linker' => [
|
||||
'name' => 'linker',
|
||||
'label' => 'COM_GETBIBLE_NOTE_LINKER_LABEL',
|
||||
'type' => 'linkers',
|
||||
'title' => false,
|
||||
'list' => 'notes',
|
||||
'store' => NULL,
|
||||
@ -114,13 +96,40 @@ class Table extends BaseTable implements Tableinterface
|
||||
'store' => NULL,
|
||||
'tab_name' => 'Details',
|
||||
],
|
||||
'verse' => [
|
||||
'name' => 'verse',
|
||||
'label' => 'COM_GETBIBLE_NOTE_VERSE_LABEL',
|
||||
'type' => 'number',
|
||||
'title' => false,
|
||||
'list' => 'notes',
|
||||
'store' => NULL,
|
||||
'tab_name' => 'Details',
|
||||
],
|
||||
'chapter' => [
|
||||
'name' => 'chapter',
|
||||
'label' => 'COM_GETBIBLE_NOTE_CHAPTER_LABEL',
|
||||
'type' => 'number',
|
||||
'title' => false,
|
||||
'list' => 'notes',
|
||||
'store' => NULL,
|
||||
'tab_name' => 'Details',
|
||||
],
|
||||
],
|
||||
'taged_verse' => [
|
||||
'book_nr' => [
|
||||
'name' => 'book_nr',
|
||||
'label' => 'COM_GETBIBLE_TAGED_VERSE_BOOK_NR_LABEL',
|
||||
'type' => 'number',
|
||||
'title' => false,
|
||||
'list' => 'taged_verses',
|
||||
'store' => NULL,
|
||||
'tab_name' => 'Details',
|
||||
],
|
||||
'abbreviation' => [
|
||||
'name' => 'abbreviation',
|
||||
'label' => 'COM_GETBIBLE_TAGED_VERSE_ABBREVIATION_LABEL',
|
||||
'type' => 'translations',
|
||||
'title' => true,
|
||||
'title' => false,
|
||||
'list' => 'taged_verses',
|
||||
'store' => NULL,
|
||||
'tab_name' => 'Details',
|
||||
@ -179,15 +188,6 @@ class Table extends BaseTable implements Tableinterface
|
||||
'store' => NULL,
|
||||
'tab_name' => 'Details',
|
||||
],
|
||||
'book_nr' => [
|
||||
'name' => 'book_nr',
|
||||
'label' => 'COM_GETBIBLE_TAGED_VERSE_BOOK_NR_LABEL',
|
||||
'type' => 'number',
|
||||
'title' => false,
|
||||
'list' => 'taged_verses',
|
||||
'store' => NULL,
|
||||
'tab_name' => 'Details',
|
||||
],
|
||||
],
|
||||
'tag' => [
|
||||
'name' => [
|
||||
|
Loading…
Reference in New Issue
Block a user