diff --git a/tests-qa/acceptance/030_Geokrety/010_GeokretyCreation/040_GeoKretType.robot b/tests-qa/acceptance/030_Geokrety/010_GeokretyCreation/040_GeoKretType.robot index bb69adff6f..a4793a461e 100644 --- a/tests-qa/acceptance/030_Geokrety/010_GeokretyCreation/040_GeoKretType.robot +++ b/tests-qa/acceptance/030_Geokrety/010_GeokretyCreation/040_GeoKretType.robot @@ -11,7 +11,7 @@ Test Setup Test Setup Type valid [Template] GeoKret is created 0 Traditional - 1 A book/CD/DVD… + 1 A book 2 A human 3 A coin 4 KretyPost diff --git a/tests-qa/acceptance/030_Geokrety/010_GeokretyCreation/060_EditGeoKret.robot b/tests-qa/acceptance/030_Geokrety/010_GeokretyCreation/060_EditGeoKret.robot index 9b354400a5..b02ea83bdc 100644 --- a/tests-qa/acceptance/030_Geokrety/010_GeokretyCreation/060_EditGeoKret.robot +++ b/tests-qa/acceptance/030_Geokrety/010_GeokretyCreation/060_EditGeoKret.robot @@ -45,7 +45,7 @@ Edit A GeoKret Location Should Be ${PAGE_GEOKRETY_1_DETAILS_URL} Element Should Contain ${GEOKRET_DETAILS_NAME} GKNewName Element Attribute Should Be ${GEOKRET_DETAILS_CREATED_ON_DATETIME}/span data-datetime 2024-05-18T00:00:00+00:00 - Element Should Contain ${GEOKRET_DETAILS_TYPE} A book/CD/DVD… + Element Should Contain ${GEOKRET_DETAILS_TYPE} A book Element Should Contain ${GEOKRET_DETAILS_MISSION} New mission Go To Url ${PAGE_GEOKRETY_EDIT_URL} diff --git a/tests-qa/acceptance/030_Geokrety/010_GeokretyCreation/070_EditGeoKretBirth.robot b/tests-qa/acceptance/030_Geokrety/010_GeokretyCreation/070_EditGeoKretBirth.robot index 3a4ec30b7c..8bd46077df 100644 --- a/tests-qa/acceptance/030_Geokrety/010_GeokretyCreation/070_EditGeoKretBirth.robot +++ b/tests-qa/acceptance/030_Geokrety/010_GeokretyCreation/070_EditGeoKretBirth.robot @@ -171,7 +171,7 @@ Shown On Home Page ${expected} = Change Born Date To Now With Validation Go To Home - Element Attribute Should Be ${HOME_RECENTLY_CREATED_GK_TABLE}//tr[1]/td[4]/span data-datetime ${expected} + Element Attribute Should Be ${HOME_RECENTLY_CREATED_GK_TABLE}//tr[1]/td[3]/span data-datetime ${expected} Shown On Inventory Picker diff --git a/tests-qa/acceptance/030_Geokrety/040_Collectible/010_ManageFlag.robot b/tests-qa/acceptance/030_Geokrety/040_Collectible/010_ManageFlag.robot index c74f617321..ddc2f22035 100644 --- a/tests-qa/acceptance/030_Geokrety/040_Collectible/010_ManageFlag.robot +++ b/tests-qa/acceptance/030_Geokrety/040_Collectible/010_ManageFlag.robot @@ -71,9 +71,53 @@ Can be enabled only if it has an holder Location Should Be ${PAGE_GEOKRETY_1_DETAILS_URL} Flash message shown has been updated +Changing type to human should change the collectible date + Sign In ${USER_1.name} Fast + + Go To Url ${PAGE_GEOKRETY_1_DETAILS_URL} + Page Should Not Contain Element ${GEOKRET_DETAILS_COLLECTIBLE} + + Go To Url ${PAGE_GEOKRETY_2_DETAILS_URL} + Element Should Contain ${GEOKRET_DETAILS_COLLECTIBLE} Non-Collectible + + Go To Url ${PAGE_GEOKRETY_2_EDIT_URL} + Select From List By Value ${GEOKRET_CREATE_TYPE_SELECT} ${2} + Click Button ${GEOKRET_CREATE_CREATE_BUTTON} + Element Should Contain ${GEOKRET_DETAILS_COLLECTIBLE} Non-Collectible + + Go To Url ${PAGE_GEOKRETY_2_EDIT_URL} + Select From List By Value ${GEOKRET_CREATE_TYPE_SELECT} ${6} + Click Button ${GEOKRET_CREATE_CREATE_BUTTON} + Element Should Contain ${GEOKRET_DETAILS_COLLECTIBLE} Non-Collectible + + Go To Url ${PAGE_GEOKRETY_2_EDIT_URL} + Select From List By Value ${GEOKRET_CREATE_TYPE_SELECT} ${8} + Click Button ${GEOKRET_CREATE_CREATE_BUTTON} + Element Should Contain ${GEOKRET_DETAILS_COLLECTIBLE} Non-Collectible + + Go To Url ${PAGE_GEOKRETY_2_EDIT_URL} + Select From List By Value ${GEOKRET_CREATE_TYPE_SELECT} ${9} + Click Button ${GEOKRET_CREATE_CREATE_BUTTON} + Page Should Not Contain Element ${GEOKRET_DETAILS_COLLECTIBLE} + + +Changing type should fail if not holder + Sign In ${USER_1.name} Fast + Post Move Fast &{MOVE_1} + + Go To Url ${PAGE_GEOKRETY_EDIT_URL} + Select From List By Value ${GEOKRET_CREATE_TYPE_SELECT} ${2} + Click Button ${GEOKRET_CREATE_CREATE_BUTTON} + Flash message shown You must hold the Geokrety to change to this type + + Go To Url ${PAGE_GEOKRETY_1_DETAILS_URL} + Page Should Not Contain Element ${GEOKRET_DETAILS_COLLECTIBLE} + + *** Keywords *** Test Setup Clear Database And Seed ${2} users Seed ${1} geokrety owned by ${1} + Seed ${1} geokrety owned by ${1} with type ${2} diff --git a/tests-qa/acceptance/ressources/Devel.robot b/tests-qa/acceptance/ressources/Devel.robot index adf032ddf3..e8944bc71c 100644 --- a/tests-qa/acceptance/ressources/Devel.robot +++ b/tests-qa/acceptance/ressources/Devel.robot @@ -151,6 +151,9 @@ Seed ${count} geokrety owned by ${userid} with mission ${mission} Seed ${count} geokrety owned by ${userid} with birthdate ${birthdate} Go To Url Fast url=${GK_URL}/devel/db/users/${userid}/geokrety/seed/${count}?birthdate=${birthdate} +Seed ${count} geokrety owned by ${userid} with type ${type} + Go To Url Fast url=${GK_URL}/devel/db/users/${userid}/geokrety/seed/${count}?type=${type} + Seed special geokrety with tracking code starting with GK owned by ${userid} Go To Url Fast ${GK_URL}/devel/db/users/${userid}/geokrety/tc-starting-with-gk diff --git a/tests-qa/acceptance/ressources/vars/Urls.robot b/tests-qa/acceptance/ressources/vars/Urls.robot index 505865eac5..5a2faf0bd4 100644 --- a/tests-qa/acceptance/ressources/vars/Urls.robot +++ b/tests-qa/acceptance/ressources/vars/Urls.robot @@ -74,6 +74,7 @@ ${PAGE_PICTURES_GALLERY_URL} ${GK_URL}/en/picture/gallery ${PAGE_GEOKRETY_CREATE_URL} ${PAGE_HOME_URL_EN}/geokrety/create ${PAGE_GEOKRETY_EDIT_URL} ${PAGE_HOME_URL_EN}/geokrety/1/edit ${PAGE_GEOKRETY_EDIT_URL_FR} ${PAGE_HOME_URL_FR}/geokrety/1/edit +${PAGE_GEOKRETY_2_EDIT_URL} ${PAGE_HOME_URL_EN}/geokrety/2/edit ${PAGE_GEOKRETY_CLAIM_URL} ${PAGE_HOME_URL_EN}/geokrety/claim ${PAGE_GEOKRETY_WATCH_URL} ${PAGE_HOME_URL_EN}/geokrety/\${params.gkid}/watch ${PAGE_GEOKRETY_UNWATCH_URL} ${PAGE_HOME_URL_EN}/geokrety/\${params.gkid}/unwatch diff --git a/website/app-templates/smarty/blocks/user/details.tpl b/website/app-templates/smarty/blocks/user/details.tpl index 19a25924db..7d66b58776 100644 --- a/website/app-templates/smarty/blocks/user/details.tpl +++ b/website/app-templates/smarty/blocks/user/details.tpl @@ -1,6 +1,6 @@
- + {$user|userlink nofilter}
{if $f3->get('SESSION.CURRENT_USER') && !$user->isCurrentUser() && $user->email} diff --git a/website/app-templates/smarty/elements/geokrety_as_list_recently_born.tpl b/website/app-templates/smarty/elements/geokrety_as_list_recently_born.tpl index 379cf133ec..8d9e3e220f 100644 --- a/website/app-templates/smarty/elements/geokrety_as_list_recently_born.tpl +++ b/website/app-templates/smarty/elements/geokrety_as_list_recently_born.tpl @@ -1,7 +1,6 @@ - {$geokret|gkicon nofilter} - {$geokret|gklink nofilter} {$geokret|gkavatar nofilter}
+ {$geokret|gkicon nofilter}{$geokret|gklink nofilter} {$geokret|gkavatar nofilter}
{$geokret->gkid} diff --git a/website/app-templates/smarty/elements/geokrety_as_list_user_inventory.tpl b/website/app-templates/smarty/elements/geokrety_as_list_user_inventory.tpl index 6bd6193c58..9b6b9fcb9b 100644 --- a/website/app-templates/smarty/elements/geokrety_as_list_user_inventory.tpl +++ b/website/app-templates/smarty/elements/geokrety_as_list_user_inventory.tpl @@ -7,7 +7,7 @@ {if $geokret->isMissing()}{/if} - {$geokret|gklink nofilter} {$geokret|gkavatar nofilter}
+ {$geokret|gkicon nofilter}{$geokret|gklink nofilter} {$geokret|gkavatar nofilter}
{$geokret->gkid} diff --git a/website/app-templates/smarty/elements/geokrety_as_list_user_owned_geokrety.tpl b/website/app-templates/smarty/elements/geokrety_as_list_user_owned_geokrety.tpl index cfe8ba1a88..26a25ec994 100644 --- a/website/app-templates/smarty/elements/geokrety_as_list_user_owned_geokrety.tpl +++ b/website/app-templates/smarty/elements/geokrety_as_list_user_owned_geokrety.tpl @@ -6,7 +6,7 @@ {$geokret|posicon nofilter} - {$geokret|gklink nofilter} {$geokret|gkavatar nofilter}
+ {$geokret|gkicon nofilter}{$geokret|gklink nofilter} {$geokret|gkavatar nofilter}
{$geokret->gkid} diff --git a/website/app-templates/smarty/elements/geokrety_as_list_user_watched_geokrety.tpl b/website/app-templates/smarty/elements/geokrety_as_list_user_watched_geokrety.tpl index 2430288055..8d6d1c8e17 100644 --- a/website/app-templates/smarty/elements/geokrety_as_list_user_watched_geokrety.tpl +++ b/website/app-templates/smarty/elements/geokrety_as_list_user_watched_geokrety.tpl @@ -5,7 +5,7 @@ {$geokret|posicon nofilter} - {$geokret|gklink nofilter} {$geokret|gkavatar nofilter}
+ {$geokret|gkicon nofilter}{$geokret|gklink nofilter} {$geokret|gkavatar nofilter}
{$geokret->gkid} diff --git a/website/app-templates/smarty/extension/SmartyGeokretyExtension.php b/website/app-templates/smarty/extension/SmartyGeokretyExtension.php index 005431ccab..d17eb7a457 100644 --- a/website/app-templates/smarty/extension/SmartyGeokretyExtension.php +++ b/website/app-templates/smarty/extension/SmartyGeokretyExtension.php @@ -58,7 +58,7 @@ function computeLogType(Geokret $geokret, ?int $locationType, ?int $lastUserId): if (is_null($locationType)) { return 9; } - if ((($locationType === LogType::LOG_TYPE_GRABBED or $locationType === LogType::LOG_TYPE_DIPPED) and $lastUserId === (is_null($geokret->owner) ? null : $geokret->owner->id)) and $locationType !== LogType::LOG_TYPE_ARCHIVED and !$geokret->type->isType(GeokretyType::GEOKRETY_TYPE_HUMAN)) { + if ((($locationType === LogType::LOG_TYPE_GRABBED or $locationType === LogType::LOG_TYPE_DIPPED) and $lastUserId === (is_null($geokret->owner) ? null : $geokret->owner->id)) and $locationType !== LogType::LOG_TYPE_ARCHIVED and !($geokret->type->isType(GeokretyType::GEOKRETY_TYPE_HUMAN) or $geokret->type->isType(GeokretyType::GEOKRETY_TYPE_CAR) or $geokret->type->isType(GeokretyType::GEOKRETY_TYPE_DOG_TAG))) { return 8; } @@ -379,7 +379,7 @@ public function smarty_modifier_gkavatar(Geokret $geokret): string { */ public function smarty_modifier_gkicon(Geokret $geokret): string { return sprintf( - '%s', + '%s', GK_CDN_IMAGES_URL, $geokret->type->getTypeId(), _('GK type icon'), diff --git a/website/app-templates/smarty/help-pages/en/help.html b/website/app-templates/smarty/help-pages/en/help.html index 780709ae53..2120470f10 100644 --- a/website/app-templates/smarty/help-pages/en/help.html +++ b/website/app-templates/smarty/help-pages/en/help.html @@ -104,9 +104,12 @@

Examples of ready GeoKrety

- example - example 2 - example + example + example 2 + example + + example +
@@ -127,9 +130,9 @@ GeoKrety types
-
+
-
+
traditional
@@ -139,7 +142,7 @@

Traditional

-
+
book
@@ -153,19 +156,19 @@

A book

-
+

A Human

- When you want to track yourself and write something like GeoBlog + When you want to track yourself and write something like GeoBlog. (Not collectible)

-
+
@@ -177,7 +180,7 @@

A Coin

-
+
@@ -189,6 +192,66 @@

KretyPost

+
+
+ +
+

Pebble

+

+ A painted small rock. +

+
+
+
+ +
+
+ +
+

Car

+

+ Stickers for vehicules. (Not collectible) +

+
+
+
+ +
+
+ +
+

Playing card

+

+ A playing card, for some Geo-Poker games. +

+
+
+
+ +
+
+ +
+

Dog tag

+

+ A dog tag on your favorite pet. (Not collectible) +

+
+
+
+ +
+
+ +
+

Jigsaw part

+

+ A Jigsaw part. +

+
+
+
+
@@ -196,7 +259,7 @@

KretyPost

- kretypost icon + kretypost icon KretyPost rules
@@ -775,8 +838,8 @@

How to decode?

diff --git a/website/app-templates/smarty/pages/home.tpl b/website/app-templates/smarty/pages/home.tpl index 3c63354ade..32a54265a9 100644 --- a/website/app-templates/smarty/pages/home.tpl +++ b/website/app-templates/smarty/pages/home.tpl @@ -77,7 +77,6 @@ - diff --git a/website/app/GeoKrety/Assets.php b/website/app/GeoKrety/Assets.php index 5c8fb399ef..c8471fc753 100644 --- a/website/app/GeoKrety/Assets.php +++ b/website/app/GeoKrety/Assets.php @@ -18,7 +18,7 @@ public function __construct(?Template $template = null) { 'Content-Security-Policy: ' .sprintf('script-src \'nonce-%s\' \'strict-dynamic\'; ', $nonce) .sprintf('img-src \'self\' data: %s %s https://www.gstatic.com/recaptcha/ https://tile.openstreetmap.org https://cdn.crowdin.com/jipt/images/ https://seccdn.libravatar.org/avatar/ https://crowdin-static.downloads.crowdin.com/avatar/ https://cdn.geokrety.org; ', GK_CDN_SERVER_URL, GK_MINIO_SERVER_URL_EXTERNAL) - .'frame-src https://www.google.com/ https://crowdin.com; ' + .'frame-src https://www.google.com/ https://www.youtube.com/ https://crowdin.com/; ' .sprintf('style-src \'self\' \'nonce-%s\'; ', $nonce) .sprintf('style-src-elem \'self\' \'unsafe-inline\' %s https://cdn.crowdin.com/jipt/jipt.css https://fonts.googleapis.com/css; ', GK_CDN_SERVER_URL) .'style-src-attr \'self\' \'unsafe-inline\'; ' @@ -31,7 +31,7 @@ public function __construct(?Template $template = null) { 'Content-Security-Policy: ' .sprintf('script-src \'nonce-%s\' \'strict-dynamic\'; ', $nonce) .sprintf('img-src \'self\' data: %s %s https://www.gstatic.com/recaptcha/ https://tile.openstreetmap.org https://seccdn.libravatar.org/avatar/ https://cdn.geokrety.org; ', GK_CDN_SERVER_URL, GK_MINIO_SERVER_URL_EXTERNAL) - .'frame-src https://www.google.com/; ' + .'frame-src https://www.google.com/ https://www.youtube.com/; ' .sprintf('style-src \'self\' \'nonce-%s\'; ', $nonce) .sprintf('style-src-elem \'self\' \'unsafe-inline\' %s; ', GK_CDN_SERVER_URL) .'style-src-attr \'self\' \'unsafe-inline\'; ' diff --git a/website/app/GeoKrety/Controller/Devel/DatabaseSeed.php b/website/app/GeoKrety/Controller/Devel/DatabaseSeed.php index 3a21007a57..c71ba9c171 100644 --- a/website/app/GeoKrety/Controller/Devel/DatabaseSeed.php +++ b/website/app/GeoKrety/Controller/Devel/DatabaseSeed.php @@ -97,6 +97,10 @@ public function geokrety(\Base $f3) { $geokret->born_on_datetime = $f3->get('GET.birthdate'); $geokret->save(); } + if ($f3->exists('GET.type')) { + $geokret->type = $f3->get('GET.type'); + $geokret->save(); + } } echo 'OK'; diff --git a/website/app/GeoKrety/GeokretyType.php b/website/app/GeoKrety/GeokretyType.php index 808c0bb734..5935f8a127 100644 --- a/website/app/GeoKrety/GeokretyType.php +++ b/website/app/GeoKrety/GeokretyType.php @@ -8,6 +8,11 @@ class GeokretyType { public const GEOKRETY_TYPE_HUMAN = 2; public const GEOKRETY_TYPE_COIN = 3; public const GEOKRETY_TYPE_KRETYPOST = 4; + public const GEOKRETY_TYPE_PEBBLE = 5; + public const GEOKRETY_TYPE_CAR = 6; + public const GEOKRETY_TYPE_PLAYING_CARD = 7; + public const GEOKRETY_TYPE_DOG_TAG = 8; + public const GEOKRETY_TYPE_JIGSAW = 9; public const GEOKRETY_TYPES = [ self::GEOKRETY_TYPE_TRADITIONAL, @@ -15,6 +20,11 @@ class GeokretyType { self::GEOKRETY_TYPE_HUMAN, self::GEOKRETY_TYPE_COIN, self::GEOKRETY_TYPE_KRETYPOST, + self::GEOKRETY_TYPE_PEBBLE, + self::GEOKRETY_TYPE_CAR, + self::GEOKRETY_TYPE_PLAYING_CARD, + self::GEOKRETY_TYPE_DOG_TAG, + self::GEOKRETY_TYPE_JIGSAW, ]; private $type; @@ -54,10 +64,15 @@ public function getTypeString() { public static function getTypes() { return [ self::GEOKRETY_TYPE_TRADITIONAL => _('Traditional'), - self::GEOKRETY_TYPE_BOOK_CD_DVD => _('A book/CD/DVD…'), + self::GEOKRETY_TYPE_BOOK_CD_DVD => _('A book'), self::GEOKRETY_TYPE_HUMAN => _('A human'), self::GEOKRETY_TYPE_COIN => _('A coin'), self::GEOKRETY_TYPE_KRETYPOST => _('KretyPost'), + self::GEOKRETY_TYPE_PEBBLE => _('A Pebble'), + self::GEOKRETY_TYPE_CAR => _('A car'), + self::GEOKRETY_TYPE_PLAYING_CARD => _('A Playing Card'), + self::GEOKRETY_TYPE_DOG_TAG => _('A dog'), + self::GEOKRETY_TYPE_JIGSAW => _('Jigsaw part'), ]; } } diff --git a/website/db/migrations/20240720180654_new_gk_types.php b/website/db/migrations/20240720180654_new_gk_types.php new file mode 100644 index 0000000000..a74c8a0a31 --- /dev/null +++ b/website/db/migrations/20240720180654_new_gk_types.php @@ -0,0 +1,129 @@ +execute(<<<'EOL' +ALTER TABLE IF EXISTS geokrety.gk_geokrety +DROP CONSTRAINT validate_type; + +ALTER TABLE IF EXISTS geokrety.gk_geokrety +ADD CONSTRAINT validate_type CHECK (type = ANY (ARRAY[0, 1, 2, 3, 4, 5, 6, 7, 8, 9])); +EOL); + + $this->execute(<<<'EOL' +CREATE FUNCTION geokrety.geokret_manage_type() + RETURNS trigger + LANGUAGE 'plpgsql' +AS $BODY$ +BEGIN + +IF NEW.type IN (2, 6, 8) THEN + IF NEW.holder != NEW.owner OR NEW.holder IS NULL THEN + RAISE 'You must hold the Geokrety to change to this type'; + END IF; + IF NEW.non_collectible IS NULL THEN + NEW.non_collectible := NOW(); + END IF; +ELSIF OLD.type IN (2, 6, 8) THEN + NEW.non_collectible := NULL; +END IF; + +RETURN NEW; +END; +$BODY$; +EOL); + + $this->execute(<<<'EOL' +CREATE OR REPLACE TRIGGER before_45_manage_type +BEFORE INSERT OR UPDATE OF type, non_collectible +ON geokrety.gk_geokrety +FOR EACH ROW +EXECUTE FUNCTION geokrety.geokret_manage_type(); +EOL); + + $this->execute(<<<'EOL' +CREATE OR REPLACE FUNCTION geokrety.map_geokrety_types(IN type smallint) + RETURNS character varying + LANGUAGE 'plpgsql' + VOLATILE + PARALLEL UNSAFE + COST 100 + +AS $BODY$ +BEGIN + +IF type = 0 THEN + RETURN 'Traditional'; +ELSIF type = 1 THEN + RETURN 'Book/CD/DVD…'; +ELSIF type = 2 THEN + RETURN 'Human/Pet'; +ELSIF type = 3 THEN + RETURN 'Coin'; +ELSIF type = 4 THEN + RETURN 'KretyPost'; +ELSIF type = 5 THEN + RETURN 'Pebble'; +ELSIF type = 6 THEN + RETURN 'Car'; +ELSIF type = 7 THEN + RETURN 'Playing card'; +ELSIF type = 8 THEN + RETURN 'Dog tag/pet'; +ELSIF type = 9 THEN + RETURN 'Jigsaw part'; +END IF; + +RAISE 'Unknown GeoKrety type'; +END; +$BODY$; +EOL); + } + + public function down(): void { + $this->execute(<<<'EOL' +ALTER TABLE IF EXISTS geokrety.gk_geokrety +DROP CONSTRAINT validate_type; + +ALTER TABLE IF EXISTS geokrety.gk_geokrety +ADD CONSTRAINT validate_type CHECK (type = ANY (ARRAY[0, 1, 2, 3, 4])); +EOL); + $this->execute('DROP TRIGGER IF EXISTS before_45_manage_type ON geokrety.gk_geokrety'); + + $this->execute(<<<'EOL' +DROP FUNCTION IF EXISTS geokrety.geokret_manage_type(); +EOL); + + $this->execute(<<<'EOL' +CREATE OR REPLACE FUNCTION geokrety.map_geokrety_types(IN type smallint) +RETURNS character varying +LANGUAGE 'plpgsql' +VOLATILE +PARALLEL UNSAFE +COST 100 + +AS $BODY$ +BEGIN + +IF type = 0 THEN +RETURN 'Traditional'; +ELSIF type = 1 THEN +RETURN 'Book/CD/DVD…'; +ELSIF type = 2 THEN +RETURN 'Human/Pet'; +ELSIF type = 3 THEN +RETURN 'Coin'; +ELSIF type = 4 THEN +RETURN 'KretyPost'; +END IF; + +RAISE 'Unknown GeoKrety type'; +END; +$BODY$; +EOL); + } +} diff --git a/website/db/tests/test-30-moves_type.sql b/website/db/tests/test-30-moves_type.sql new file mode 100644 index 0000000000..d9d0866b40 --- /dev/null +++ b/website/db/tests/test-30-moves_type.sql @@ -0,0 +1,140 @@ +-- Start transaction and plan the tests. + +BEGIN; + +-- SELECT * FROM no_plan(); +SELECT plan(87); + +INSERT INTO "gk_users" ("id", "username", "registration_ip") VALUES (1, 'test 1', '127.0.0.1'); +INSERT INTO "gk_users" ("id", "username", "registration_ip") VALUES (2, 'test 2', '127.0.0.1'); +INSERT INTO "gk_users" ("id", "username", "registration_ip") VALUES (3, 'test 3', '127.0.0.1'); + +-- Traditional +SELECT lives_ok($$INSERT INTO "gk_geokrety" ("id", "name", "type", "owner", "holder", "created_on_datetime") VALUES (1, 'test', 0, 1, 1, '2024-07-21 12:15:00+00')$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (1, 1, '2024-07-21 12:15:01+00', 0, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (1, 1, '2024-07-21 12:15:02+00', 1, NULL)$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (1, 1, '2024-07-21 12:15:03+00', 2, NULL)$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (1, 1, '2024-07-21 12:15:04+00', 3, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (1, 1, '2024-07-21 12:15:05+00', 4, NULL)$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (1, 1, '2024-07-21 12:15:06+00', 5, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); + +-- Book +SELECT lives_ok($$INSERT INTO "gk_geokrety" ("id", "name", "type", "owner", "holder", "created_on_datetime") VALUES (2, 'test', 1, 1, 1, '2024-07-21 12:15:00+00')$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (2, 1, '2024-07-21 12:15:01+00', 0, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (2, 1, '2024-07-21 12:15:02+00', 1, NULL)$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (2, 1, '2024-07-21 12:15:03+00', 2, NULL)$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (2, 1, '2024-07-21 12:15:04+00', 3, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (2, 1, '2024-07-21 12:15:05+00', 4, NULL)$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (2, 1, '2024-07-21 12:15:06+00', 5, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); + +-- Human +SELECT lives_ok($$INSERT INTO "gk_geokrety" ("id", "name", "type", "owner", "holder", "created_on_datetime") VALUES (3, 'test', 2, 1, 2, '2024-07-21 12:15:00+00')$$); +SELECT isnt(non_collectible, NULL) FROM "gk_geokrety" WHERE id=3; +SELECT lives_ok($$UPDATE "gk_geokrety" SET non_collectible='2024-07-21 12:15:00+00' WHERE id=3;$$); +SELECT is(non_collectible, '2024-07-21 12:15:00+00') FROM "gk_geokrety" WHERE id=3; +-- Owner +SELECT throws_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (3, 1, '2024-07-21 12:15:01+00', 0, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); +SELECT throws_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (3, 1, '2024-07-21 12:15:02+00', 1, NULL)$$); +-- Holder +SELECT throws_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (3, 2, '2024-07-21 12:15:03+00', 0, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); +SELECT throws_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (3, 2, '2024-07-21 12:15:04+00', 1, NULL)$$); +-- Other user +SELECT throws_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (3, 3, '2024-07-21 12:15:05+00', 0, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); +SELECT throws_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (3, 3, '2024-07-21 12:15:06+00', 1, NULL)$$); + +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (3, 1, '2024-07-21 12:15:07+00', 2, NULL)$$); +SELECT throws_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (3, 1, '2024-07-21 12:15:08+00', 3, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (3, 3, '2024-07-21 12:15:08+00', 3, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (3, 1, '2024-07-21 12:15:09+00', 4, NULL)$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (3, 1, '2024-07-21 12:15:10+00', 5, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); + +-- Coin +SELECT lives_ok($$INSERT INTO "gk_geokrety" ("id", "name", "type", "owner", "holder", "created_on_datetime") VALUES (4, 'test', 3, 1, 1, '2024-07-21 12:15:00+00')$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (4, 1, '2024-07-21 12:15:01+00', 0, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (4, 1, '2024-07-21 12:15:02+00', 1, NULL)$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (4, 1, '2024-07-21 12:15:03+00', 2, NULL)$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (4, 1, '2024-07-21 12:15:04+00', 3, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (4, 1, '2024-07-21 12:15:05+00', 4, NULL)$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (4, 1, '2024-07-21 12:15:06+00', 5, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); + +-- KretyPost +SELECT lives_ok($$INSERT INTO "gk_geokrety" ("id", "name", "type", "owner", "holder", "created_on_datetime") VALUES (5, 'test', 4, 1, 1, '2024-07-21 12:15:00+00')$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (5, 1, '2024-07-21 12:15:01+00', 0, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (5, 1, '2024-07-21 12:15:02+00', 1, NULL)$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (5, 1, '2024-07-21 12:15:03+00', 2, NULL)$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (5, 1, '2024-07-21 12:15:04+00', 3, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (5, 1, '2024-07-21 12:15:05+00', 4, NULL)$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (5, 1, '2024-07-21 12:15:06+00', 5, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); + +-- Pebble +SELECT lives_ok($$INSERT INTO "gk_geokrety" ("id", "name", "type", "owner", "holder", "created_on_datetime") VALUES (6, 'test', 5, 1, 1, '2024-07-21 12:15:00+00')$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (6, 1, '2024-07-21 12:15:01+00', 0, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (6, 1, '2024-07-21 12:15:02+00', 1, NULL)$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (6, 1, '2024-07-21 12:15:03+00', 2, NULL)$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (6, 1, '2024-07-21 12:15:04+00', 3, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (6, 1, '2024-07-21 12:15:05+00', 4, NULL)$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (6, 1, '2024-07-21 12:15:06+00', 5, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); + +-- Car +SELECT lives_ok($$INSERT INTO "gk_geokrety" ("id", "name", "type", "owner", "holder", "created_on_datetime") VALUES (7, 'test', 6, 1, 1, '2024-07-21 12:15:00+00')$$); +SELECT isnt(non_collectible, NULL) FROM "gk_geokrety" WHERE id=7; +SELECT lives_ok($$UPDATE "gk_geokrety" SET non_collectible='2024-07-21 12:15:00+00' WHERE id=7;$$); +SELECT is(non_collectible, '2024-07-21 12:15:00+00') FROM "gk_geokrety" WHERE id=7; +-- Owner +SELECT throws_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (7, 1, '2024-07-21 12:15:01+00', 0, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); +SELECT throws_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (7, 1, '2024-07-21 12:15:02+00', 1, NULL)$$); +-- Holder +SELECT throws_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (7, 2, '2024-07-21 12:15:03+00', 0, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); +SELECT throws_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (7, 2, '2024-07-21 12:15:04+00', 1, NULL)$$); +-- Other user +SELECT throws_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (7, 3, '2024-07-21 12:15:05+00', 0, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); +SELECT throws_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (7, 3, '2024-07-21 12:15:06+00', 1, NULL)$$); + +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (7, 1, '2024-07-21 12:15:03+00', 2, NULL)$$); + +SELECT throws_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (7, 1, '2024-07-21 12:15:08+00', 3, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (7, 3, '2024-07-21 12:15:08+00', 3, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); + +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (7, 1, '2024-07-21 12:15:05+00', 4, NULL)$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (7, 1, '2024-07-21 12:15:06+00', 5, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); + +-- Card +SELECT lives_ok($$INSERT INTO "gk_geokrety" ("id", "name", "type", "owner", "holder", "created_on_datetime") VALUES (8, 'test', 7, 1, 1, '2024-07-21 12:15:00+00')$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (8, 1, '2024-07-21 12:15:01+00', 0, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (8, 1, '2024-07-21 12:15:02+00', 1, NULL)$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (8, 1, '2024-07-21 12:15:03+00', 2, NULL)$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (8, 1, '2024-07-21 12:15:04+00', 3, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (8, 1, '2024-07-21 12:15:05+00', 4, NULL)$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (8, 1, '2024-07-21 12:15:06+00', 5, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); + +-- Dog +SELECT lives_ok($$INSERT INTO "gk_geokrety" ("id", "name", "type", "owner", "holder", "created_on_datetime") VALUES (9, 'test', 8, 1, 1, '2024-07-21 12:15:00+00')$$); +SELECT isnt(non_collectible, NULL) FROM "gk_geokrety" WHERE id=9; +SELECT lives_ok($$UPDATE "gk_geokrety" SET non_collectible='2024-07-21 12:15:00+00' WHERE id=9;$$); +SELECT is(non_collectible, '2024-07-21 12:15:00+00') FROM "gk_geokrety" WHERE id=9; +-- Owner +SELECT throws_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (9, 1, '2024-07-21 12:15:01+00', 0, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); +SELECT throws_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (9, 1, '2024-07-21 12:15:02+00', 1, NULL)$$); +-- Holder +SELECT throws_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (9, 2, '2024-07-21 12:15:03+00', 0, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); +SELECT throws_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (9, 2, '2024-07-21 12:15:04+00', 1, NULL)$$); +-- Other user +SELECT throws_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (9, 3, '2024-07-21 12:15:05+00', 0, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); +SELECT throws_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (9, 3, '2024-07-21 12:15:06+00', 1, NULL)$$); + +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (9, 1, '2024-07-21 12:15:07+00', 2, NULL)$$); + +SELECT throws_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (9, 1, '2024-07-21 12:15:08+00', 3, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (9, 3, '2024-07-21 12:15:08+00', 3, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); + +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (9, 1, '2024-07-21 12:15:09+00', 4, NULL)$$); +SELECT lives_ok($$INSERT INTO "gk_moves" ("geokret", "author", "moved_on_datetime", "move_type", "position") VALUES (9, 1, '2024-07-21 12:15:10+00', 5, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540')$$); + + + + + + +-- Finish the tests and clean up. +SELECT * FROM finish(); +ROLLBACK; diff --git a/website/db/tests/test-52-geokret-type.sql b/website/db/tests/test-52-geokret-type.sql new file mode 100644 index 0000000000..11dae3a9b7 --- /dev/null +++ b/website/db/tests/test-52-geokret-type.sql @@ -0,0 +1,50 @@ +-- Start transaction and plan the tests. + +BEGIN; + +-- SELECT * FROM no_plan(); +SELECT plan(24); + +INSERT INTO "gk_users" ("id", "username", "registration_ip") VALUES (1, 'test 1', '127.0.0.1'); + +-- Automatic +SELECT lives_ok($$INSERT INTO "gk_geokrety" ("id", "name", "type", "owner", "holder") VALUES (1, 'test', 0, 1, 1)$$); +SELECT is(non_collectible, NULL) FROM "gk_geokrety" WHERE id=1; +SELECT lives_ok($$INSERT INTO "gk_geokrety" ("id", "name", "type", "owner", "holder") VALUES (2, 'test', 1, 1, 1)$$); +SELECT is(non_collectible, NULL) FROM "gk_geokrety" WHERE id=2; + +SELECT lives_ok($$INSERT INTO "gk_geokrety" ("id", "name", "type", "owner", "holder") VALUES (3, 'test', 2, 1, 1)$$); +SELECT isnt(non_collectible, NULL) FROM "gk_geokrety" WHERE id=3; +UPDATE "gk_geokrety" SET non_collectible=NULL WHERE id=3; +SELECT isnt(non_collectible, NULL) FROM "gk_geokrety" WHERE id=3; + +SELECT lives_ok($$INSERT INTO "gk_geokrety" ("id", "name", "type", "owner", "holder") VALUES (4, 'test', 3, 1, 1)$$); +SELECT is(non_collectible, NULL) FROM "gk_geokrety" WHERE id=4; +SELECT lives_ok($$INSERT INTO "gk_geokrety" ("id", "name", "type", "owner", "holder") VALUES (5, 'test', 4, 1, 1)$$); +SELECT is(non_collectible, NULL) FROM "gk_geokrety" WHERE id=5; + +SELECT lives_ok($$INSERT INTO "gk_geokrety" ("id", "name", "type", "owner", "holder") VALUES (6, 'test', 5, 1, 1)$$); +SELECT is(non_collectible, NULL) FROM "gk_geokrety" WHERE id=6; + +SELECT lives_ok($$INSERT INTO "gk_geokrety" ("id", "name", "type", "owner", "holder") VALUES (7, 'test', 6, 1, 1)$$); +SELECT isnt(non_collectible, NULL) FROM "gk_geokrety" WHERE id=7; +UPDATE "gk_geokrety" SET non_collectible=NULL WHERE id=7; +SELECT isnt(non_collectible, NULL) FROM "gk_geokrety" WHERE id=7; + +SELECT lives_ok($$INSERT INTO "gk_geokrety" ("id", "name", "type", "owner", "holder") VALUES (8, 'test', 7, 1, 1)$$); +SELECT is(non_collectible, NULL) FROM "gk_geokrety" WHERE id=8; + +SELECT lives_ok($$INSERT INTO "gk_geokrety" ("id", "name", "type", "owner", "holder") VALUES (9, 'test', 8, 1, 1)$$); +SELECT isnt(non_collectible, NULL) FROM "gk_geokrety" WHERE id=9; +UPDATE "gk_geokrety" SET non_collectible=NULL WHERE id=9; +SELECT isnt(non_collectible, NULL) FROM "gk_geokrety" WHERE id=9; + +SELECT lives_ok($$INSERT INTO "gk_geokrety" ("id", "name", "type", "owner", "holder") VALUES (10, 'test', 9, 1, 1)$$); +SELECT is(non_collectible, NULL) FROM "gk_geokrety" WHERE id=8; + +SELECT throws_ok($$INSERT INTO "gk_geokrety" ("id", "name", "type", "owner", "holder") VALUES (11, 'test', 10, 1, 1)$$); + + +-- Finish the tests and clean up. +SELECT * FROM finish(); +ROLLBACK; diff --git a/website/public/app-ui/css/app.scss b/website/public/app-ui/css/app.scss index 97a8115353..78b1259e9e 100644 --- a/website/public/app-ui/css/app.scss +++ b/website/public/app-ui/css/app.scss @@ -146,3 +146,19 @@ input.input-uc { .separator:not(:empty)::after { margin-left: .25em; } + +.row.same-height { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + flex-wrap: wrap; +} +.row.same-height > [class*='col-'] { + display: flex; + flex-direction: column; + + .thumbnail { + height: 100%; + } +}
{t}ID{/t} {t}Owner{/t} {t}Born{/t}