fix: refs #7759 mockDate and increased myt version
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Guillermo Bonet 2025-02-21 10:38:28 +01:00
parent c74714a825
commit c80e6f3240
5 changed files with 5 additions and 43 deletions

View File

@ -1,5 +1,5 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION util.mockTime()
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION util.mockTime()
RETURNS DATETIME
DETERMINISTIC
BEGIN
@ -8,7 +8,7 @@ END$$
DELIMITER ;
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION util.mockUtcTime()
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION util.mockUtcTime()
RETURNS DATETIME
DETERMINISTIC
BEGIN

View File

@ -5,7 +5,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `util`.`mockTime`()
BEGIN
/**
* Returns current dateTime
*
*
* @return current datetime
*/
RETURN NOW();

View File

@ -1,26 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `util`.`mockTimeBase`(vIsUtc BOOL)
RETURNS datetime
DETERMINISTIC
BEGIN
/**
* Returns the date formatted to utc if vIsUtc or config.mocTz if not
*
* @param vIsUtc If date must be returned as UTC format
* @return The formatted mock time
*/
DECLARE vMockUtcTime DATETIME;
DECLARE vMockTz VARCHAR(255);
SELECT mockUtcTime, mockTz
INTO vMockUtcTime, vMockTz
FROM config
LIMIT 1;
IF vIsUtc OR vMockTz IS NULL THEN
RETURN vMockUtcTime;
ELSE
RETURN CONVERT_TZ(vMockUtcTime, '+00:00', vMockTz);
END IF;
END$$
DELIMITER ;

View File

@ -4,22 +4,10 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `util`.`mockUtcTime`()
DETERMINISTIC
BEGIN
/**
* Returns the UTC datetime in mockTime format or timeStamp depending on config table
* Returns current UTC dateTime
*
* @return The UTC datetime format
*/
-- FIXME: #5041 Commented because there is slowness when querying a table
/*
DECLARE vMockEnabled BOOL;
SELECT mockEnabled INTO vMockEnabled FROM config LIMIT 1;
IF vMockEnabled THEN
RETURN mockTimeBase(TRUE);
ELSE
RETURN UTC_TIMESTAMP();
END IF;
*/
RETURN UTC_TIMESTAMP();
END$$
DELIMITER ;

View File

@ -60,7 +60,7 @@
"@babel/register": "^7.7.7",
"@commitlint/cli": "^19.2.1",
"@commitlint/config-conventional": "^19.1.0",
"@verdnatura/myt": "^1.6.12",
"@verdnatura/myt": "^1.6.13",
"angular-mocks": "^1.7.9",
"babel-jest": "^26.0.1",
"babel-loader": "^8.2.4",