diff options
author | href <href@random.sh> | 2021-09-01 12:42:31 +0200 |
---|---|---|
committer | href <href@random.sh> | 2021-09-01 12:42:31 +0200 |
commit | 37def62ce652cc7a825d5b69a780fe0fed1a031a (patch) | |
tree | 79c1d64403b43a5e5c349341a79f7b43d32c6eb4 /lib/lsg_irc/alcolog_plugin.ex | |
parent | track: clean on reconnecting (diff) |
alcoolog: remove migration code
Diffstat (limited to 'lib/lsg_irc/alcolog_plugin.ex')
-rw-r--r-- | lib/lsg_irc/alcolog_plugin.ex | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/lib/lsg_irc/alcolog_plugin.ex b/lib/lsg_irc/alcolog_plugin.ex index c758117..0812874 100644 --- a/lib/lsg_irc/alcolog_plugin.ex +++ b/lib/lsg_irc/alcolog_plugin.ex @@ -184,36 +184,6 @@ defmodule LSG.IRC.AlcoologPlugin do dets_meta_filename = (LSG.data_path() <> "/" <> "alcoolisme_meta.dets") |> String.to_charlist {:ok, meta} = :dets.open_file(dets_meta_filename, [{:type,:set}]) state = %{dets: dets, meta: meta, ets: ets} - - traverse_fun = fn(obj, dets) -> - case obj do - object = {nick, date, volumes, active, cl, deg, name, comment, meta} -> - :ets.insert(ets, {{nick, date}, volumes, active, cl, deg, name, comment, meta}) - dets - object = {nick, date, volumes, active, name, comment} -> - IO.puts("Migrating object #{inspect object}") - {cl, deg} = with \ - %{"cl" => cl, "deg" => deg} <- Regex.named_captures(~r/^(?<cl>\d+[.]\d+)cl\s+(?<deg>\d+[.]\d+)°$/, name), - {cl, _} <- Util.float_paparse(cl), - {deg, _} <- Util.float_paparse(deg) - do - {cl, deg} - else - _ -> {nil, nil} - end - new = {nick, date, volumes, active, cl, deg, name, comment, Map.new()} - :dets.delete_object(dets, obj) - :dets.insert(dets, new) - - :ets.insert(ets, {{nick, date}, volumes, active, cl, deg, name, comment, Map.new()}) - dets - _ -> - dets - end - end - :dets.foldl(traverse_fun, dets, dets) - :dets.sync(dets) - {:ok, state} end |