Compare commits

...

2 Commits

Author SHA1 Message Date
a0621216ec Use QI multiplier for evaluating markings in PuQI, set explicit constant
visibility
2024-06-11 19:12:27 +02:00
8500a401d0 Remove superfluous underscores in class member names
The underscores indicated private members, where they were public.
2023-10-10 11:27:56 +02:00
2 changed files with 102 additions and 102 deletions

View File

@ -19,19 +19,19 @@ declare(strict_types = 1);
*/
final class MinimaldatensatzCheck {
public bool $_has_title;
public bool $_has_type;
public bool $_has_topic_category;
public bool $_has_inventory_number;
public bool $_has_description;
public bool $_has_material;
public bool $_has_technique;
public bool $_has_measurements;
public bool $_has_event;
public bool $_has_tag;
public bool $_has_image;
public bool $_has_image_license;
public bool $_has_image_owner;
public bool $has_title;
public bool $has_type;
public bool $has_topic_category;
public bool $has_inventory_number;
public bool $has_description;
public bool $has_material;
public bool $has_technique;
public bool $has_measurements;
public bool $has_event;
public bool $has_tag;
public bool $has_image;
public bool $has_image_license;
public bool $has_image_owner;
/**
* Returns an evaluation message for a given required field.
@ -40,7 +40,7 @@ final class MinimaldatensatzCheck {
* @param boolean $passed Sets whether the field is available and filled or not.
* @param string $fieldname_de German language field name.
*
* @return array{field: string, passed: bool, text: string}
* @return array{field: string, required: true, passed: bool, text: string}
*/
private function _generateOutputMessageForRequiredField(string $field, bool $passed, string $fieldname_de):array {
@ -63,7 +63,7 @@ final class MinimaldatensatzCheck {
* @param boolean $passed Sets whether the field is available and filled or not.
* @param string $fieldname_de German language field name.
*
* @return array{field: string, passed: bool, text: string}
* @return array{field: string, required: false, passed: bool, text: string}
*/
private function _generateOutputMessageForOptionalField(string $field, bool $passed, string $fieldname_de):array {
@ -82,50 +82,50 @@ final class MinimaldatensatzCheck {
/**
* Returns a list of evaluations / checks for each field.
*
* @return array<array{field: string, required: bool, passed: bool, text: string}>
* @return list<array{field: string, required: bool, passed: bool, text: string}>
*/
public function evaluate():array {
$output = [];
if (!isset($this->_has_title)) throw new MinimaldatensatzCheckIncompletelyImplementedException("Title has not been checked");
$output[] = $this->_generateOutputMessageForRequiredField("title", $this->_has_title, "Objekttitel oder -benennung");
if (!isset($this->has_title)) throw new MinimaldatensatzCheckIncompletelyImplementedException("Title has not been checked");
$output[] = $this->_generateOutputMessageForRequiredField("title", $this->has_title, "Objekttitel oder -benennung");
if (!isset($this->_has_type)) throw new MinimaldatensatzCheckIncompletelyImplementedException("Type has not been checked");
$output[] = $this->_generateOutputMessageForRequiredField("type", $this->_has_type, "Objekttyp oder -bezeichnung");
if (!isset($this->has_type)) throw new MinimaldatensatzCheckIncompletelyImplementedException("Type has not been checked");
$output[] = $this->_generateOutputMessageForRequiredField("type", $this->has_type, "Objekttyp oder -bezeichnung");
if (!isset($this->_has_topic_category)) throw new MinimaldatensatzCheckIncompletelyImplementedException("Topic category has not been checked");
$output[] = $this->_generateOutputMessageForOptionalField("topic_category", $this->_has_topic_category, "Themenkategorie");
if (!isset($this->has_topic_category)) throw new MinimaldatensatzCheckIncompletelyImplementedException("Topic category has not been checked");
$output[] = $this->_generateOutputMessageForOptionalField("topic_category", $this->has_topic_category, "Themenkategorie");
if (!isset($this->_has_inventory_number)) throw new MinimaldatensatzCheckIncompletelyImplementedException("Inventory number has not been checked");
$output[] = $this->_generateOutputMessageForRequiredField("inventory_number", $this->_has_inventory_number, "Inventarnummer");
if (!isset($this->has_inventory_number)) throw new MinimaldatensatzCheckIncompletelyImplementedException("Inventory number has not been checked");
$output[] = $this->_generateOutputMessageForRequiredField("inventory_number", $this->has_inventory_number, "Inventarnummer");
if (!isset($this->_has_description)) throw new MinimaldatensatzCheckIncompletelyImplementedException("Description has not been checked");
$output[] = $this->_generateOutputMessageForOptionalField("description", $this->_has_description, "Objektbeschreibung");
if (!isset($this->has_description)) throw new MinimaldatensatzCheckIncompletelyImplementedException("Description has not been checked");
$output[] = $this->_generateOutputMessageForOptionalField("description", $this->has_description, "Objektbeschreibung");
if (!isset($this->_has_material)) throw new MinimaldatensatzCheckIncompletelyImplementedException("Material has not been checked");
$output[] = $this->_generateOutputMessageForOptionalField("material", $this->_has_material, "Material");
if (!isset($this->has_material)) throw new MinimaldatensatzCheckIncompletelyImplementedException("Material has not been checked");
$output[] = $this->_generateOutputMessageForOptionalField("material", $this->has_material, "Material");
if (!isset($this->_has_technique)) throw new MinimaldatensatzCheckIncompletelyImplementedException("Technique has not been checked");
$output[] = $this->_generateOutputMessageForOptionalField("technique", $this->_has_technique, "Technik");
if (!isset($this->has_technique)) throw new MinimaldatensatzCheckIncompletelyImplementedException("Technique has not been checked");
$output[] = $this->_generateOutputMessageForOptionalField("technique", $this->has_technique, "Technik");
if (!isset($this->_has_measurements)) throw new MinimaldatensatzCheckIncompletelyImplementedException("Measurements has not been checked");
$output[] = $this->_generateOutputMessageForOptionalField("measurements", $this->_has_measurements, "Maße");
if (!isset($this->has_measurements)) throw new MinimaldatensatzCheckIncompletelyImplementedException("Measurements has not been checked");
$output[] = $this->_generateOutputMessageForOptionalField("measurements", $this->has_measurements, "Maße");
if (!isset($this->_has_event)) throw new MinimaldatensatzCheckIncompletelyImplementedException("Event has not been checked");
$output[] = $this->_generateOutputMessageForRequiredField("event", $this->_has_event, "Ereignis in der Objektgeschichte (Feldgruppe)");
if (!isset($this->has_event)) throw new MinimaldatensatzCheckIncompletelyImplementedException("Event has not been checked");
$output[] = $this->_generateOutputMessageForRequiredField("event", $this->has_event, "Ereignis in der Objektgeschichte (Feldgruppe)");
if (!isset($this->_has_tag)) throw new MinimaldatensatzCheckIncompletelyImplementedException("Tag has not been checked");
$output[] = $this->_generateOutputMessageForOptionalField("tag", $this->_has_tag, "Inhaltsschlagwort");
if (!isset($this->has_tag)) throw new MinimaldatensatzCheckIncompletelyImplementedException("Tag has not been checked");
$output[] = $this->_generateOutputMessageForOptionalField("tag", $this->has_tag, "Inhaltsschlagwort");
if (!isset($this->_has_image)) throw new MinimaldatensatzCheckIncompletelyImplementedException("Image has not been checked");
$output[] = $this->_generateOutputMessageForRequiredField("image", $this->_has_image, "Mediendatei (Feldgruppe)");
if (!isset($this->has_image)) throw new MinimaldatensatzCheckIncompletelyImplementedException("Image has not been checked");
$output[] = $this->_generateOutputMessageForRequiredField("image", $this->has_image, "Mediendatei (Feldgruppe)");
if (!isset($this->_has_image_license)) throw new MinimaldatensatzCheckIncompletelyImplementedException("Image license has not been checked");
$output[] = $this->_generateOutputMessageForRequiredField("image_license", $this->_has_image_license, "Nutzungsrechte Mediendatei");
if (!isset($this->has_image_license)) throw new MinimaldatensatzCheckIncompletelyImplementedException("Image license has not been checked");
$output[] = $this->_generateOutputMessageForRequiredField("image_license", $this->has_image_license, "Nutzungsrechte Mediendatei");
if (!isset($this->_has_image_owner)) throw new MinimaldatensatzCheckIncompletelyImplementedException("Image owner has not been checked");
$output[] = $this->_generateOutputMessageForRequiredField("image_owner", $this->_has_image_owner, "Rechteinhaber*in Mediendatei");
if (!isset($this->has_image_owner)) throw new MinimaldatensatzCheckIncompletelyImplementedException("Image owner has not been checked");
$output[] = $this->_generateOutputMessageForRequiredField("image_owner", $this->has_image_owner, "Rechteinhaber*in Mediendatei");
return $output;

View File

@ -30,71 +30,71 @@ final class MDPuqi {
private const THRESHOLD_CC_OBJECT_DESC_GREAT = 1750;
private const THRESHOLD_CC_OBJECT_DESC_QUITE_LONG = 5000;
const THRESHOLD_TAGS_TOO_MANY = 10;
const THRESHOLD_IMG_TOO_SMALL = 600; // px
const THRESHOLD_IMG_SMALL = 800; // px
const THRESHOLD_IMG_GOOD_SIZE_SHORTER = 1200; // px
const THRESHOLD_IMG_GOOD_SIZE_LONGER = 1920; // px
public const THRESHOLD_TAGS_TOO_MANY = 10;
public const THRESHOLD_IMG_TOO_SMALL = 600; // px
public const THRESHOLD_IMG_SMALL = 800; // px
public const THRESHOLD_IMG_GOOD_SIZE_SHORTER = 1200; // px
public const THRESHOLD_IMG_GOOD_SIZE_LONGER = 1920; // px
const LICENSES_OPEN_ACCESS_PD = ["CC0", "Public Domain Mark", "Orphan Work"];
const LICENSES_OPEN_ACCESS_ATTRIBUTION = ["CC BY"];
const LICENSES_CLOSED_ACCESS = ["RR-F", "RR-P", "RR-R"];
public const LICENSES_OPEN_ACCESS_PD = ["CC0", "Public Domain Mark", "Orphan Work"];
public const LICENSES_OPEN_ACCESS_ATTRIBUTION = ["CC BY"];
public const LICENSES_CLOSED_ACCESS = ["RR-F", "RR-P", "RR-R"];
const QI_REWARD_DESCRIPTION_LENGTH_GOOD = 3;
const QI_REWARD_DESCRIPTION_LENGTH_GREAT = 6;
const QI_REWARD_EVENTS_MULTIPLIER = 5;
const QI_REWARD_TAGS_MULTIPLIER = 3;
const QI_REWARD_LITERATURE_MULTIPLIER = 2;
const QI_REWARD_HYPERLINKS_MULTIPLIER = 2;
const QI_REWARD_DOCUMENTS_MULTIPLIER = 1;
const QI_REWARD_LINKED_OBJS_MULTIPLIER = 3;
const QI_REWARD_SERIES_MULTIPLIER = 4;
const QI_REWARD_EXHIBITIONS_MULTIPLIER = 4;
const QI_REWARD_TRANSLATIONS_MULTIPLIER = 10;
const QI_REWARD_TRANSCRIPTS_MULTIPLIER = 10;
const QI_REWARD_OBJ_IS_REF_MULTIPLIER = 5;
const QI_REWARD_OBJ_RECEPTION_MULTIPLIER = 1;
const QI_REWARD_MARKINGS_MULTIPLIER = 3;
const QI_REWARD_IMGS_RESOURCES_MULTIPLIER = 3;
const QI_REWARD_IMAGE_SIZE_LARGE = 1;
const QI_REWARD_IMAGE_LICENCE_OPEN_ACCESS = 2;
const QI_REWARD_IMAGE_LICENCE_OPEN_ACCESS_ATTRIBUTION = 1;
const QI_REWARD_METADATA_LICENCE_OPEN_ACCESS = 5;
const QI_REWARD_METADATA_LICENCE_OPEN_ACCESS_ATTRIBUTION = 3;
public const QI_REWARD_DESCRIPTION_LENGTH_GOOD = 3;
private const QI_REWARD_DESCRIPTION_LENGTH_GREAT = 6;
private const QI_REWARD_EVENTS_MULTIPLIER = 5;
private const QI_REWARD_TAGS_MULTIPLIER = 3;
private const QI_REWARD_LITERATURE_MULTIPLIER = 2;
private const QI_REWARD_HYPERLINKS_MULTIPLIER = 2;
private const QI_REWARD_DOCUMENTS_MULTIPLIER = 1;
private const QI_REWARD_LINKED_OBJS_MULTIPLIER = 3;
private const QI_REWARD_SERIES_MULTIPLIER = 4;
private const QI_REWARD_EXHIBITIONS_MULTIPLIER = 4;
private const QI_REWARD_TRANSLATIONS_MULTIPLIER = 10;
private const QI_REWARD_TRANSCRIPTS_MULTIPLIER = 10;
private const QI_REWARD_OBJ_IS_REF_MULTIPLIER = 5;
private const QI_REWARD_OBJ_RECEPTION_MULTIPLIER = 1;
private const QI_REWARD_MARKINGS_MULTIPLIER = 3;
private const QI_REWARD_IMGS_RESOURCES_MULTIPLIER = 3;
private const QI_REWARD_IMAGE_SIZE_LARGE = 1;
private const QI_REWARD_IMAGE_LICENCE_OPEN_ACCESS = 2;
private const QI_REWARD_IMAGE_LICENCE_OPEN_ACCESS_ATTRIBUTION = 1;
private const QI_REWARD_METADATA_LICENCE_OPEN_ACCESS = 5;
private const QI_REWARD_METADATA_LICENCE_OPEN_ACCESS_ATTRIBUTION = 3;
const QI_REWARD_PUBLIC_INSCRIPTION = 3;
const QI_REWARD_PUBLIC_COMPARABLE_OBJECTS = 3;
const QI_REWARD_PUBLIC_DETAILED_DESCRIPTION = 5;
private const QI_REWARD_PUBLIC_INSCRIPTION = 3;
private const QI_REWARD_PUBLIC_COMPARABLE_OBJECTS = 3;
private const QI_REWARD_PUBLIC_DETAILED_DESCRIPTION = 5;
const QI_PENALTY_EMPTY_OBJECT_TYPE = -20;
const QI_PENALTY_TITLE_ONE_WORD = -3;
const QI_PENALTY_TITLE_DUPLICATE = -5;
const QI_PENALTY_TITLE_TOO_LONG = -5;
const QI_PENALTY_DESCRIPTION_DUPLICATE = -25;
const QI_PENALTY_DESCRIPTION_TOO_SHORT = -10;
const QI_PENALTY_DESCRIPTION_SHORT = -5;
const QI_PENALTY_DESCRIPTION_TOO_LONG = -6;
const QI_PENALTY_EMPTY_MATTECH = -3;
const QI_PENALTY_EMPTY_MEASUREMENTS = -5;
private const QI_PENALTY_EMPTY_OBJECT_TYPE = -20;
private const QI_PENALTY_TITLE_ONE_WORD = -3;
private const QI_PENALTY_TITLE_DUPLICATE = -5;
private const QI_PENALTY_TITLE_TOO_LONG = -5;
private const QI_PENALTY_DESCRIPTION_DUPLICATE = -25;
private const QI_PENALTY_DESCRIPTION_TOO_SHORT = -10;
private const QI_PENALTY_DESCRIPTION_SHORT = -5;
private const QI_PENALTY_DESCRIPTION_TOO_LONG = -6;
private const QI_PENALTY_EMPTY_MATTECH = -3;
private const QI_PENALTY_EMPTY_MEASUREMENTS = -5;
const QI_PENALTY_NO_IMAGE = -10;
const QI_PENALTY_NO_COLLECTION = -10;
const QI_PENALTY_MULTIPLIER_EVENT_PART_DOUBLE_LINKED_AS_RELATED = -10;
const QI_PENALTY_NO_EVENTS = -15;
const QI_PENALTY_NO_TAG = -15;
const QI_PENALTY_ONLY_ONE_TAG = -10;
const QI_PENALTY_ONLY_TWO_TAG = -5;
const QI_PENALTY_TOO_MANY_TAGS = -3; // Per tag of more than 10 tags
private const QI_PENALTY_NO_IMAGE = -10;
private const QI_PENALTY_NO_COLLECTION = -10;
private const QI_PENALTY_MULTIPLIER_EVENT_PART_DOUBLE_LINKED_AS_RELATED = -10;
private const QI_PENALTY_NO_EVENTS = -15;
private const QI_PENALTY_NO_TAG = -15;
private const QI_PENALTY_ONLY_ONE_TAG = -10;
private const QI_PENALTY_ONLY_TWO_TAG = -5;
private const QI_PENALTY_TOO_MANY_TAGS = -3; // Per tag of more than 10 tags
const QI_PENALTY_IMAGE_FILE_MISSING = -5;
const QI_PENALTY_IMAGE_TOO_SMALL = -5;
const QI_PENALTY_IMAGE_SMALL = -2;
const QI_PENALTY_IMAGE_NO_OWNER_NO_LICENCE = -15;
const QI_PENALTY_IMAGE_NO_OWNER = -10;
const QI_PENALTY_IMAGE_NO_LICENCE = -10;
const QI_PENALTY_IMAGE_LICENCE_CLOSED_ACCESS = -1;
const QI_PENALTY_METADATA_NO_LICENCE = -10;
const QI_PENALTY_METADATA_LICENCE_CLOSED_ACCESS = -3;
private const QI_PENALTY_IMAGE_FILE_MISSING = -5;
private const QI_PENALTY_IMAGE_TOO_SMALL = -5;
private const QI_PENALTY_IMAGE_SMALL = -2;
private const QI_PENALTY_IMAGE_NO_OWNER_NO_LICENCE = -15;
private const QI_PENALTY_IMAGE_NO_OWNER = -10;
private const QI_PENALTY_IMAGE_NO_LICENCE = -10;
private const QI_PENALTY_IMAGE_LICENCE_CLOSED_ACCESS = -1;
private const QI_PENALTY_METADATA_NO_LICENCE = -10;
private const QI_PENALTY_METADATA_LICENCE_CLOSED_ACCESS = -3;
public const INDICATOR_THRESHOLD_COLOR_RED = -30;
public const INDICATOR_THRESHOLD_COLOR_BLUE = 10;
@ -740,7 +740,7 @@ final class MDPuqi {
MDPuqiCheckSection::markingCount,
MDPuqiMessageStatus::praise,
$this->_tlLoader->tl("quality", "quality", "markings_exist"),
self::QI_REWARD_OBJ_IS_REF_MULTIPLIER * $count,
self::QI_REWARD_MARKINGS_MULTIPLIER * $count,
);
}