public static function LingotekSync::getChunkCountByStatus in Lingotek Translation 7.5
Same name and namespace in other branches
- 7.3 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getChunkCountByStatus()
- 7.4 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getChunkCountByStatus()
File
- lib/
Drupal/ lingotek/ LingotekSync.php, line 383 - LingotekSync
Class
- LingotekSync
- A utility class for Lingotek Syncing.
Code
public static function getChunkCountByStatus($status) {
$all_lids = count(self::getAllChunkLids());
$dirty_lids = count(self::getDirtyChunkLids());
$current_lids = $all_lids - $dirty_lids;
$chunk_size = LINGOTEK_CONFIG_CHUNK_SIZE;
$num_edited_docs = round(($all_lids - $dirty_lids) / $chunk_size);
$num_total_docs = round($all_lids / $chunk_size);
$num_pending_docs = count(self::getChunksWithPendingTranslations());
$num_curr_docs = $num_total_docs - $num_edited_docs - $num_pending_docs;
$num_curr_docs = $num_curr_docs > 0 ? $num_curr_docs : 0;
if ($status == self::STATUS_EDITED) {
return $num_edited_docs;
}
elseif ($status == self::STATUS_PENDING) {
return $num_pending_docs;
}
elseif ($status == self::STATUS_CURRENT) {
return $num_curr_docs;
}
LingotekLog::error('Unknown config-chunk status: @status', array(
'@status' => $status,
));
return 0;
}