Модуль:FetchData: відмінності між версіями

нема опису редагування
Немає опису редагування
Немає опису редагування
Рядок 731: Рядок 731:
             end
             end
              
              
            if player_in_game then
          if player_in_game then
                 local role = get_player_role(player_name, cells)
                 local role = get_player_role(player_name, cells)
                 local result = get_player_result(role, cells[16])
                 local result = get_player_result(role, cells[16])
               
                -- Конвертуємо час з "37 хв 26 с" в "37:26"
                local time_raw = cells[5] or ""
                local minutes, seconds = mw.ustring.match(time_raw, "(%d+)%s*хв%s*(%d+)%s*с")
                local time_formatted = time_raw
                if minutes and seconds then
                    time_formatted = minutes .. ":" .. string.format("%02d", tonumber(seconds))
                end
                  
                  
                 table.insert(games, {
                 table.insert(games, {
                     short = cells[3] or "",
                     short = cells[3] or "",
                     tournament = cells[4] or "",
                     tournament = cells[4] or "",
                     time = cells[5] or "",
                     time = time_formatted,
                     role = role,
                     role = role,
                     result = result,
                     result = result,
Рядок 776: Рядок 784:
     headerRow:tag('th'):wikitext('Результат')
     headerRow:tag('th'):wikitext('Результат')
     headerRow:tag('th'):wikitext('Запис')
     headerRow:tag('th'):wikitext('Запис')
   
 
     -- Кольори для ролей
     -- Колір для ролей (білий)
     local role_colors = {
     local role_color = "#fff"
        ["Мирний"] = "#8bc34a",
        ["Шериф"] = "#2196f3",
        ["Мафія"] = "#9c27b0",
        ["Дон"] = "#e91e63"
    }
      
      
     for _, game in ipairs(games) do
     for _, game in ipairs(games) do
Рядок 819: Рядок 822:
             resultCell:tag('span')
             resultCell:tag('span')
                 :css('color', '#4caf50')
                 :css('color', '#4caf50')
                 :wikitext('Перемога')
                 :wikitext('В')
        elseif game.result == "Поразка" then
      elseif game.result == "Поразка" then
             resultCell:tag('span')
             resultCell:tag('span')
                 :css('color', 'indianred')
                 :css('color', 'indianred')
                 :wikitext('Поразка')
                 :wikitext('П')
         else
         else
             resultCell:wikitext(game.result)
             resultCell:wikitext(game.result)