Adds time left for chapter and document to the screensaver message options (#7897)

pull/7909/head
Brian Hughes 3 years ago committed by GitHub
parent 6c35e01acb
commit ba65dc155b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -451,7 +451,6 @@ ReaderFooter.default_settings = {
lock_tap = false,
items_separator = "bar",
progress_pct_format = "0",
duration_format = "modern",
progress_margin = false,
}
@ -1388,45 +1387,6 @@ function ReaderFooter:addToMainMenu(menu_items)
},
},
},
{
text = _("Duration format"),
sub_item_table = {
{
text_func = function()
local current_duration_format = self.settings.duration_format
local return_text
self.settings.duration_format = "modern"
return_text = footerTextGeneratorMap.book_time_to_read(self)
self.settings.duration_format = current_duration_format
return T(_("Modern (%1)"), return_text)
end,
checked_func = function()
return self.settings.duration_format == "modern"
end,
callback = function()
self.settings.duration_format = "modern"
self:refreshFooter(true)
end,
},
{
text_func = function()
local current_duration_format = self.settings.duration_format
local return_text
self.settings.duration_format = "classic"
return_text = footerTextGeneratorMap.book_time_to_read(self)
self.settings.duration_format = current_duration_format
return T(_("Classic (%1)"), return_text)
end,
checked_func = function()
return self.settings.duration_format == "classic"
end,
callback = function()
self.settings.duration_format = "classic"
self:refreshFooter(true)
end,
},
}
},
}
})
if Device:hasBattery() then
@ -1901,6 +1861,7 @@ function ReaderFooter:setTocMarkers(reset)
return true
end
-- This is implemented by the Statistics plugin
function ReaderFooter:getAvgTimePerPage()
return
end
@ -1908,12 +1869,9 @@ end
function ReaderFooter:getDataFromStatistics(title, pages)
local sec = _("N/A")
local average_time_per_page = self:getAvgTimePerPage()
local user_duration_format = G_reader_settings:readSetting("duration_format", "classic")
if average_time_per_page then
if self.settings.duration_format == "classic" then
sec = util.secondsToClock(pages * average_time_per_page, true)
else
sec = util.secondsToHClock(pages * average_time_per_page, true)
end
sec = util.secondsToClockDuration(user_duration_format, pages * average_time_per_page, true)
end
return title .. sec
end

@ -7,7 +7,7 @@ local lfs = require("libs/libkoreader-lfs")
local logger = require("logger")
-- Date at which the last migration snippet was added
local CURRENT_MIGRATION_DATE = 20210622
local CURRENT_MIGRATION_DATE = 20210629
-- Retrieve the date of the previous migration, if any
local last_migration_date = G_reader_settings:readSetting("last_migration_date", 0)
@ -263,5 +263,17 @@ if last_migration_date < 20210531 then
end
end
-- 202100629, Moves Duration Format to Date Time settings for other plugins to use, https://github.com/koreader/koreader/pull/7897
if last_migration_date < 202100629 then
logger.info("Performing one-time migration for 202100629")
local footer = G_reader_settings:child("footer")
if footer and footer:has("duration_format") then
local user_format = footer:readSetting("duration_format")
G_reader_settings:saveSetting("duration_format", user_format)
footer:delSetting("duration_format")
end
end
-- We're done, store the current migration date
G_reader_settings:saveSetting("last_migration_date", CURRENT_MIGRATION_DATE)

@ -83,6 +83,42 @@ common_settings.time = {
G_reader_settings:flipNilOrFalse("twelve_hour_clock")
UIManager:broadcastEvent(Event:new("TimeFormatChanged"))
end,
},
{
text_func = function ()
local duration_format = G_reader_settings:readSetting("duration_format", "classic")
return T(_("Duration Format (%1)"), duration_format)
end,
sub_item_table = {
{
text_func = function()
local util = require('util');
-- sample text shows 1:23:45
local duration_format_str = util.secondsToClockDuration("classic", 5025, false);
return T(_("Classic (%1)"), duration_format_str)
end,
checked_func = function()
return G_reader_settings:readSetting("duration_format") == "classic"
end,
callback = function()
G_reader_settings:saveSetting("duration_format", "classic")
end,
},
{
text_func = function()
local util = require('util');
-- sample text shows 1h23m45s
local duration_format_str = util.secondsToClockDuration("modern", 5025, false);
return T(_("Modern (%1)"), duration_format_str)
end,
checked_func = function()
return G_reader_settings:readSetting("duration_format") == "modern"
end,
callback = function()
G_reader_settings:saveSetting("duration_format", "modern")
end,
},
}
}
}
}

@ -93,7 +93,25 @@ function Screensaver:_getRandomImage(dir)
return dir .. pics[math.random(i)]
end
local function expandSpecial(message, fallback)
-- This is implemented by the Statistics plugin
function Screensaver:getAvgTimePerPage()
return
end
function Screensaver:_calcAverageTimeForPages(pages)
local sec = _("N/A")
local average_time_per_page = self:getAvgTimePerPage()
-- Compare average_time_per_page against itself to make sure it's not nan
if average_time_per_page and average_time_per_page == average_time_per_page and pages then
local util = require("util")
local user_duration_format = G_reader_settings:readSetting("duration_format", "classic")
sec = util.secondsToClockDuration(user_duration_format, pages * average_time_per_page, true)
end
return sec
end
function Screensaver:expandSpecial(message, fallback)
-- Expand special character sequences in given message.
-- %p percentage read
-- %c current page
@ -101,6 +119,8 @@ local function expandSpecial(message, fallback)
-- %T document title
-- %A document authors
-- %S document series
-- %h time left in chapter
-- %H time left in document
if G_reader_settings:hasNot("lastfile") then
return fallback
@ -115,6 +135,8 @@ local function expandSpecial(message, fallback)
local title = _("N/A")
local authors = _("N/A")
local series = _("N/A")
local time_left_chapter = _("N/A")
local time_left_document = _("N/A")
local ReaderUI = require("apps/reader/readerui")
local ui = ReaderUI:_getRunningInstance()
@ -130,6 +152,8 @@ local function expandSpecial(message, fallback)
authors = props.authors and props.authors ~= "" and props.authors or authors
series = props.series and props.series ~= "" and props.series or series
end
time_left_chapter = self:_calcAverageTimeForPages(ui.toc:getChapterPagesLeft(currentpage) or doc:getTotalPagesLeft(currentpage))
time_left_document = self:_calcAverageTimeForPages(doc:getTotalPagesLeft(currentpage))
elseif DocSettings:hasSidecarFile(lastfile) then
-- If there's no ReaderUI instance, but the file has sidecar data, use that
local docinfo = DocSettings:open(lastfile)
@ -142,14 +166,20 @@ local function expandSpecial(message, fallback)
authors = docinfo.data.doc_props.authors and docinfo.data.doc_props.authors ~= "" and docinfo.data.doc_props.authors or authors
series = docinfo.data.doc_props.series and docinfo.data.doc_props.series ~= "" and docinfo.data.doc_props.series or series
end
-- Unable to set time_left_chapter and time_left_document without ReaderUI, so leave N/A
end
ret = string.gsub(ret, "%%c", currentpage)
ret = string.gsub(ret, "%%t", totalpages)
ret = string.gsub(ret, "%%p", percent)
ret = string.gsub(ret, "%%T", title)
ret = string.gsub(ret, "%%A", authors)
ret = string.gsub(ret, "%%S", series)
local replace = {
["%c"] = currentpage,
["%t"] = totalpages,
["%p"] = percent,
["%T"] = title,
["%A"] = authors,
["%S"] = series,
["%h"] = time_left_chapter,
["%H"] = time_left_document,
}
ret = ret:gsub("(%%%a)", replace)
return ret
end
@ -328,7 +358,7 @@ function Screensaver:setMessage()
or self.default_screensaver_message
self.input_dialog = InputDialog:new{
title = "Screensaver message",
description = _("Enter the message to be displayed by the screensaver. The following escape sequences can be used:\n %p percentage read\n %c current page number\n %t total number of pages\n %T title\n %A authors\n %S series"),
description = _("Enter the message to be displayed by the screensaver. The following escape sequences can be used:\n %p percentage read\n %c current page number\n %t total number of pages\n %T title\n %A authors\n %S series\n %h time left in chapter\n %H time left in document"),
input = screensaver_message,
buttons = {
{
@ -567,7 +597,7 @@ function Screensaver:show()
end
-- NOTE: Only attempt to expand if there are special characters in the message.
if screensaver_message:find("%%") then
screensaver_message = expandSpecial(screensaver_message, self.fallback_message or self.default_screensaver_message)
screensaver_message = self:expandSpecial(screensaver_message, self.fallback_message or self.default_screensaver_message)
end
local message_pos

@ -144,7 +144,8 @@ end
function BookStatusWidget:getStatHours()
if stats_book.time then
return util.secondsToClock(stats_book.time, false)
local user_duration_format = G_reader_settings:readSetting("duration_format", "classic")
return util.secondsToClockDuration(user_duration_format, stats_book.time, false)
else
return _("N/A")
end

@ -220,6 +220,21 @@ function util.secondsToHClock(seconds, withoutSeconds, hmsFormat)
end
end
--- Converts seconds to a clock type (classic or modern), based on the given format preference
--- "Classic" format calls secondsToClock, and "Modern" format calls secondsToHClock
---- @string Either "modern" for 1h30' or "classic" for 1:30
---- @bool withoutSeconds if true 1h30' or 1:30, if false 1h30'10'' or 1:30:10
---- @bool hmsFormat, modern format only, if true format 1h30m10s
---- @treturn string clock string in the specific format of 1h30', 1h30'10'' or 1:30'
function util.secondsToClockDuration(format, seconds, withoutSeconds, hmsFormat)
if format == "modern" then
return util.secondsToHClock(seconds, withoutSeconds, hmsFormat)
else
-- Assume "classic" to give safe default
return util.secondsToClock(seconds, withoutSeconds)
end
end
if jit.os == "Windows" then
--- Converts timestamp to an hour string
---- @int seconds number of seconds

@ -159,6 +159,11 @@ function ReaderStatistics:init()
return self.avg_time
end
end
Screensaver.getAvgTimePerPage = function()
if self.settings.is_enabled then
return self.avg_time
end
end
Screensaver.getReaderProgress = function()
self:insertDB(self.id_curr_book)
local current_duration, current_pages = self:getCurrentBookStats()
@ -1305,30 +1310,31 @@ function ReaderStatistics:getCurrentStat(id_book)
local estimate_days_to_read = math.ceil(time_to_read/(book_read_time/tonumber(total_days)))
local estimate_end_of_read_date = os.date("%Y-%m-%d", tonumber(now_ts + estimate_days_to_read * 86400))
local estimates_valid = time_to_read > 0 -- above values could be 'nan' and 'nil'
local user_duration_format = G_reader_settings:readSetting("duration_format", "classic")
return {
-- Global statistics (may consider other books than current book)
-- since last resume
{ _("Time spent reading this session"), util.secondsToClock(current_duration, false) },
{ _("Time spent reading this session"), util.secondsToClockDuration(user_duration_format, current_duration, false) },
{ _("Pages read this session"), tonumber(current_pages) },
-- today
{ _("Time spent reading today"), util.secondsToClock(today_duration, false) },
{ _("Time spent reading today"), util.secondsToClockDuration(user_duration_format, today_duration, false) },
{ _("Pages read today"), tonumber(today_pages), separator = true },
-- Current book statistics
-- Includes re-reads
{ _("Total time spent on this book"), util.secondsToClock(total_time_book, false) },
{ _("Total time spent on this book"), util.secondsToClockDuration(user_duration_format, total_time_book, false) },
-- Capped to self.settings.max_sec per distinct page
{ _("Time spent reading this book"), util.secondsToClock(book_read_time, false) },
{ _("Time spent reading this book"), util.secondsToClockDuration(user_duration_format, book_read_time, false) },
-- per days
{ _("Reading started"), os.date("%Y-%m-%d (%H:%M)", tonumber(first_open))},
{ _("Days reading this book"), tonumber(total_days) },
{ _("Average time per day"), util.secondsToClock(book_read_time/tonumber(total_days), false) },
{ _("Average time per day"), util.secondsToClockDuration(user_duration_format, book_read_time/tonumber(total_days), false) },
-- per page (% read)
{ _("Average time per page"), util.secondsToClock(self.avg_time, false) },
{ _("Average time per page"), util.secondsToClockDuration(user_duration_format, self.avg_time, false) },
{ _("Pages read"), string.format("%d (%d%%)", total_read_pages, Math.round(100*total_read_pages/self.data.pages)) },
-- current page (% completed)
{ _("Current page/Total pages"), string.format("%d/%d (%d%%)", self.curr_page, self.data.pages, Math.round(100*self.curr_page/self.data.pages)) },
-- estimation, from current page to end of book
{ _("Estimated time to read"), estimates_valid and util.secondsToClock(time_to_read, false) or _("N/A") },
{ _("Estimated time to read"), estimates_valid and util.secondsToClockDuration(user_duration_format, time_to_read, false) or _("N/A") },
{ _("Estimated reading finished"), estimates_valid and
T(N_("%1 (1 day)", "%1 (%2 days)", estimate_days_to_read), estimate_end_of_read_date, estimate_days_to_read)
or _("N/A") },
@ -1421,16 +1427,17 @@ function ReaderStatistics:getBookStat(id_book)
pages = 1
end
local avg_time_per_page = book_read_time / book_read_pages
local user_duration_format = G_reader_settings:readSetting("duration_format")
return {
{ _("Title"), title},
{ _("Authors"), authors},
{ _("Reading started"), os.date("%Y-%m-%d (%H:%M)", tonumber(first_open))},
{ _("Last read"), os.date("%Y-%m-%d (%H:%M)", tonumber(last_open))},
{ _("Days reading this book"), tonumber(total_days) },
{ _("Total time spent on this book"), util.secondsToClock(total_time_book, false) },
{ _("Time spent reading this book"), util.secondsToClock(book_read_time, false) },
{ _("Average time per day"), util.secondsToClock(book_read_time/tonumber(total_days), false) },
{ _("Average time per page"), util.secondsToClock(avg_time_per_page, false) },
{ _("Total time spent on this book"), util.secondsToClockDuration(user_duration_format, total_time_book, false) },
{ _("Time spent reading this book"), util.secondsToClockDuration(user_duration_format, book_read_time, false) },
{ _("Average time per day"), util.secondsToClockDuration(user_duration_format, book_read_time/tonumber(total_days), false) },
{ _("Average time per page"), util.secondsToClockDuration(user_duration_format, avg_time_per_page, false) },
{ _("Pages read"), string.format("%d (%d%%)", total_read_pages, Math.round(100*total_read_pages/pages)) },
{ _("Last read page/Total pages"), string.format("%d/%d (%d%%)", last_page, pages, Math.round(100*last_page/pages)) },
{ _("Highlights"), highlights, separator = true },
@ -1596,6 +1603,7 @@ function ReaderStatistics:getDatesFromAll(sdays, ptype, book_mode)
local now_stamp = os.time()
local one_day = 86400 -- one day in seconds
local period_begin = 0
local user_duration_format = G_reader_settings:readSetting("duration_format")
if sdays > 0 then
period_begin = now_stamp - ((sdays-1) * one_day) - from_begin_day
end
@ -1647,7 +1655,7 @@ function ReaderStatistics:getDatesFromAll(sdays, ptype, book_mode)
local stop_month = os.time{year=year_end, month=month_end, day=1, hour=0, min=0 }
table.insert(results, {
date_text,
T(_("Pages: (%1) Time: %2"), tonumber(result_book[2][i]), util.secondsToClock(tonumber(result_book[3][i]), false)),
T(_("Pages: (%1) Time: %2"), tonumber(result_book[2][i]), util.secondsToClockDuration(user_duration_format, tonumber(result_book[3][i]), false)),
callback = function()
self:callbackMonthly(start_month, stop_month, date_text, book_mode)
end,
@ -1661,7 +1669,7 @@ function ReaderStatistics:getDatesFromAll(sdays, ptype, book_mode)
begin_week = begin_week - weekday * 86400
table.insert(results, {
date_text,
T(_("Pages: (%1) Time: %2"), tonumber(result_book[2][i]), util.secondsToClock(tonumber(result_book[3][i]), false)),
T(_("Pages: (%1) Time: %2"), tonumber(result_book[2][i]), util.secondsToClockDuration(user_duration_format, tonumber(result_book[3][i]), false)),
callback = function()
self:callbackWeekly(begin_week, begin_week + 7 * 86400, date_text, book_mode)
end,
@ -1672,7 +1680,7 @@ function ReaderStatistics:getDatesFromAll(sdays, ptype, book_mode)
- 60 * tonumber(string.sub(time_book,3,4)) - tonumber(string.sub(time_book,5,6))
table.insert(results, {
date_text,
T(_("Pages: (%1) Time: %2"), tonumber(result_book[2][i]), util.secondsToClock(tonumber(result_book[3][i]), false)),
T(_("Pages: (%1) Time: %2"), tonumber(result_book[2][i]), util.secondsToClockDuration(user_duration_format, tonumber(result_book[3][i]), false)),
callback = function()
self:callbackDaily(begin_day, begin_day + 86400, date_text)
end,
@ -1707,12 +1715,13 @@ function ReaderStatistics:getDaysFromPeriod(period_begin, period_end)
if result_book == nil then
return {}
end
local user_duration_format = G_reader_settings:readSetting("duration_format")
for i=1, #result_book.dates do
local time_begin = os.time{year=string.sub(result_book[1][i],1,4), month=string.sub(result_book[1][i],6,7),
day=string.sub(result_book[1][i],9,10), hour=0, min=0, sec=0 }
table.insert(results, {
result_book[1][i],
T(_("Pages: (%1) Time: %2"), tonumber(result_book[2][i]), util.secondsToClock(tonumber(result_book[3][i]), false)),
T(_("Pages: (%1) Time: %2"), tonumber(result_book[2][i]), util.secondsToClockDuration(user_duration_format, tonumber(result_book[3][i]), false)),
callback = function()
local kv = self.kv
UIManager:close(kv)
@ -1751,10 +1760,11 @@ function ReaderStatistics:getBooksFromPeriod(period_begin, period_end, callback_
if result_book == nil then
return {}
end
local user_duration_format = G_reader_settings:readSetting("duration_format")
for i=1, #result_book.title do
table.insert(results, {
result_book[1][i],
T(_("%1 (%2)"), util.secondsToClock(tonumber(result_book[2][i]), false), tonumber(result_book[3][i])),
T(_("%1 (%2)"), util.secondsToClockDuration(user_duration_format, tonumber(result_book[2][i]), false), tonumber(result_book[3][i])),
callback = function()
local kv = self.kv
UIManager:close(self.kv)
@ -1847,10 +1857,11 @@ function ReaderStatistics:getDatesForBook(id_book)
if result_book == nil then
return {}
end
local user_duration_format = G_reader_settings:readSetting("duration_format")
for i=1, #result_book.dates do
table.insert(results, {
result_book[1][i],
T(_("Pages: (%1) Time: %2"), tonumber(result_book[2][i]), util.secondsToClock(tonumber(result_book[3][i]), false))
T(_("Pages: (%1) Time: %2"), tonumber(result_book[2][i]), util.secondsToClockDuration(user_duration_format, tonumber(result_book[3][i]), false))
})
end
return results
@ -1880,7 +1891,7 @@ function ReaderStatistics:getTotalStats()
else
nr_books = 0
end
local user_duration_format = G_reader_settings:readSetting("duration_format")
for i=1, nr_books do
local id_book = tonumber(id_book_tbl[1][i])
sql_stmt = [[
@ -1900,7 +1911,7 @@ function ReaderStatistics:getTotalStats()
end
table.insert(total_stats, {
book_title,
util.secondsToClock(total_time_book, false),
util.secondsToClockDuration(user_duration_format, total_time_book, false),
callback = function()
local kv = self.kv
UIManager:close(self.kv)
@ -1920,7 +1931,7 @@ function ReaderStatistics:getTotalStats()
end
conn:close()
return T(_("Total time spent reading: %1"), util.secondsToClock(total_books_time, false)), total_stats
return T(_("Total time spent reading: %1"), util.secondsToClockDuration(user_duration_format, total_books_time, false)), total_stats
end
function ReaderStatistics:genResetBookSubItemTable()
@ -1976,6 +1987,7 @@ function ReaderStatistics:resetBook()
nr_books = 0
end
local user_duration_format = G_reader_settings:readSetting("duration_format")
local total_time_book
local kv_reset_book
for i=1, nr_books do
@ -1999,7 +2011,7 @@ function ReaderStatistics:resetBook()
if id_book ~= self.id_curr_book then
table.insert(total_stats, {
book_title,
util.secondsToClock(total_time_book, false),
util.secondsToClockDuration(user_duration_format, total_time_book, false),
id_book,
callback = function()
UIManager:show(ConfirmBox:new{

@ -200,6 +200,7 @@ function ReaderProgress:genWeekStats(stats_day)
local select_day_time
local diff_time
local now_time = os.time()
local user_duration_format = G_reader_settings:readSetting("duration_format")
local height = Screen:scaleBySize(60)
local statistics_container = CenterContainer:new{
dimen = Geom:new{ w = self.screen_width , h = height },
@ -247,7 +248,7 @@ function ReaderProgress:genWeekStats(stats_day)
dimen = Geom:new{ w = self.screen_width , h = height / 3 },
TextWidget:new{
padding = Size.padding.small,
text = date_format_show .. " - " .. util.secondsToClock(select_day_time, true),
text = date_format_show .. " - " .. util.secondsToClockDuration(user_duration_format, select_day_time, true),
face = Font:getFace("smallffont"),
},
},
@ -286,6 +287,7 @@ function ReaderProgress:genSummaryDay(width)
local statistics_group = VerticalGroup:new{ align = "left" }
local tile_width = width / 4
local tile_height = height / 3
local user_duration_format = G_reader_settings:readSetting("duration_format")
local titles_group = HorizontalGroup:new{
align = "center",
@ -340,7 +342,7 @@ function ReaderProgress:genSummaryDay(width)
CenterContainer:new{
dimen = Geom:new{ w = tile_width, h = tile_height },
TextWidget:new{
text = util.secondsToClock(self.current_duration, true),
text = util.secondsToClockDuration(user_duration_format, self.current_duration, true),
face = self.medium_font_face,
},
},
@ -354,7 +356,7 @@ function ReaderProgress:genSummaryDay(width)
CenterContainer:new{
dimen = Geom:new{ w = tile_width, h = tile_height },
TextWidget:new{
text = util.secondsToClock(self.today_duration, true),
text = util.secondsToClockDuration(user_duration_format, self.today_duration, true),
face = self.medium_font_face,
},
},
@ -380,6 +382,7 @@ function ReaderProgress:genSummaryWeek(width)
local statistics_group = VerticalGroup:new{ align = "left" }
local tile_width = width / 4
local tile_height = height / 3
local user_duration_format = G_reader_settings:readSetting("duration_format")
local total_group = HorizontalGroup:new{
align = "center",
CenterContainer:new{
@ -466,7 +469,7 @@ function ReaderProgress:genSummaryWeek(width)
CenterContainer:new{
dimen = Geom:new{ w = tile_width, h = tile_height },
TextWidget:new{
text = util.secondsToClock(math.floor(total_time), true),
text = util.secondsToClockDuration(user_duration_format, math.floor(total_time), true),
face = self.medium_font_face,
},
},
@ -480,7 +483,7 @@ function ReaderProgress:genSummaryWeek(width)
CenterContainer:new{
dimen = Geom:new{ w = tile_width, h = tile_height },
TextWidget:new{
text = util.secondsToClock(math.floor(total_time) / 7, true),
text = util.secondsToClockDuration(user_duration_format, math.floor(total_time) / 7, true),
face = self.medium_font_face,
}
}

@ -482,6 +482,41 @@ describe("util module", function()
end)
end)
describe("secondsToClockDuration()", function()
it("should change type based on format", function()
assert.is_equal("10h01m30s",
util.secondsToClockDuration("modern", 36090, false, true))
assert.is_equal("10:01:30",
util.secondsToClockDuration("classic", 36090, false))
assert.is_equal("10:01:30",
util.secondsToClockDuration("unknown", 36090, false))
assert.is_equal("10:01:30",
util.secondsToClockDuration(nil, 36090, false))
end)
it("should pass along withoutSeconds", function()
assert.is_equal("10h01m30s",
util.secondsToClockDuration("modern", 36090, false, true))
assert.is_equal("10h02",
util.secondsToClockDuration("modern", 36090, true, true))
assert.is_equal("10:01:30",
util.secondsToClockDuration("classic", 36090, false))
assert.is_equal("10:02",
util.secondsToClockDuration("classic", 36090, true))
end)
it("should pass along hmsFormat for modern format", function()
assert.is_equal("10h01'30''",
util.secondsToClockDuration("modern", 36090))
assert.is_equal("10h01m30s",
util.secondsToClockDuration("modern", 36090, false, true))
assert.is_equal("10h02",
util.secondsToClockDuration("modern", 36090, true, false))
assert.is_equal("10:01:30",
util.secondsToClockDuration("classic", 36090, false, true))
assert.is_equal("10:01:30",
util.secondsToClockDuration("classic", 36090, false, false))
end)
end) -- end my changes
describe("urlEncode() and urlDecode", function()
it("should encode string", function()
assert.is_equal("Secret_Password123", util.urlEncode("Secret_Password123"))

Loading…
Cancel
Save