neiam
/apollos_crib
It's Apollo's Crib
public · Issues · Pulls 1 · Labels · Forks · Compare · Actions failure · Badges · Packages
Log in to mark this repository.
Format: the files the Credo fixes touch
03fe2d0 · Gabe Morell · 2026-11-04 20:41
Message
{commit_body(@commit)}
Files changed
modified
apps/room_air_quality/lib/room_air_quality/aqi_worker.ex
+1
−0
| 346 | 346 | sh = ts |> DateTime.add(-hours_ago * 60 * 60, :second) |
| 347 | 347 | file_str = sh |> Timex.format!("%Y%m%d%H", :strftime) |
| 348 | 348 | date_str = sh |> Timex.format!("%Y%m%d", :strftime) |
| 349 | + | |
| 349 | 350 | "https://s3-us-west-1.amazonaws.com//files.airnowtech.org/airnow/#{sh.year}/#{date_str}/HourlyAQObs_#{file_str}.dat" |
| 350 | 351 | end |
| 351 | 352 |
modified
apps/room_bourse/lib/room_bourse/worker.ex
+7
−3
| 112 | 112 | A single quote, or `{:error, message}` with something worth showing a user. |
| 113 | 113 | """ |
| 114 | 114 | def quote_for(symbol) do |
| 115 | − url = "#{endpoint()}/v8/finance/chart/#{URI.encode(symbol, &URI.char_unreserved?/1)}?range=1d&interval=1d" | |
| 115 | + url = | |
| 116 | + "#{endpoint()}/v8/finance/chart/#{URI.encode(symbol, &URI.char_unreserved?/1)}?range=1d&interval=1d" | |
| 116 | 117 | |
| 117 | 118 | # Yahoo returns 404 for unknown symbols with a usable description, so a |
| 118 | 119 | # non-200 body is still worth decoding before giving up on it. |
| 159 | 160 | price = meta["regularMarketPrice"] |
| 160 | 161 | previous = meta["chartPreviousClose"] || meta["previousClose"] |
| 161 | 162 | change = if is_number(price) and is_number(previous), do: price - previous |
| 162 | − change_pct = if is_number(change) and is_number(previous) and previous != 0, do: change / previous * 100 | |
| 163 | + | |
| 164 | + change_pct = | |
| 165 | + if is_number(change) and is_number(previous) and previous != 0, do: change / previous * 100 | |
| 163 | 166 | |
| 164 | 167 | %{ |
| 165 | 168 | symbol: meta["symbol"] || String.upcase(symbol), |
| 214 | 217 | |
| 215 | 218 | # Yahoo rejects requests without a browser-ish agent. |
| 216 | 219 | defp user_agent, |
| 217 | − do: Application.get_env(:room_bourse, :user_agent, "Mozilla/5.0 (compatible; ApollosCrib/1.0)") | |
| 220 | + do: | |
| 221 | + Application.get_env(:room_bourse, :user_agent, "Mozilla/5.0 (compatible; ApollosCrib/1.0)") | |
| 218 | 222 | |
| 219 | 223 | defp normalise(symbol) when is_binary(symbol) do |
| 220 | 224 | case symbol |> String.trim() |> String.upcase() do |
modified
apps/room_drought/lib/room_drought/worker.ex
+7
−2
| 60 | 60 | |
| 61 | 61 | def handle_cast(:refresh_usdm, state) do |
| 62 | 62 | if usdm_enabled?(state.inst) do |
| 63 | − Logger.info("Drought::#{state.inst.id} refreshing USDM (#{MapSet.size(state.targets)} targets)") | |
| 63 | + Logger.info( | |
| 64 | + "Drought::#{state.inst.id} refreshing USDM (#{MapSet.size(state.targets)} targets)" | |
| 65 | + ) | |
| 64 | 66 | |
| 65 | 67 | new_usdm = |
| 66 | 68 | state.targets |
| 130 | 132 | defp via(name), do: via_tuple(name) |
| 131 | 133 | defp via_tuple(name), do: {:via, Registry, {@registry, name}} |
| 132 | 134 | |
| 133 | − defp usdm_enabled?(%{enabled: true, config: %{__struct__: @drought_config_module, products: products}}) | |
| 135 | + defp usdm_enabled?(%{ | |
| 136 | + enabled: true, | |
| 137 | + config: %{__struct__: @drought_config_module, products: products} | |
| 138 | + }) | |
| 134 | 139 | when is_list(products), |
| 135 | 140 | do: "usdm" in products |
| 136 | 141 |
modified
apps/room_ephem/lib/room_ephem/ephem_worker.ex
+31
−26
| 21 | 21 | # "Astronomical Algorithms", low-precision moon position formulas. |
| 22 | 22 | |
| 23 | 23 | defp jd_from_date(%Date{year: y, month: m, day: d}) do |
| 24 | − a = div(14 - m, 12) | |
| 24 | + a = div(14 - m, 12) | |
| 25 | 25 | yy = y + 4800 - a |
| 26 | 26 | mm = m + 12 * a - 3 |
| 27 | − (d + div(153 * mm + 2, 5) + 365 * yy + div(yy, 4) - div(yy, 100) + div(yy, 400) - 32045) - 0.5 | |
| 27 | + d + div(153 * mm + 2, 5) + 365 * yy + div(yy, 4) - div(yy, 100) + div(yy, 400) - 32045 - 0.5 | |
| 28 | 28 | end |
| 29 | 29 | |
| 30 | 30 | defp sin_d(deg), do: :math.sin(deg * :math.pi() / 180.0) |
| 31 | 31 | defp cos_d(deg), do: :math.cos(deg * :math.pi() / 180.0) |
| 32 | 32 | defp tan_d(deg), do: :math.tan(deg * :math.pi() / 180.0) |
| 33 | − defp asin_d(x), do: :math.asin(x) * 180.0 / :math.pi() | |
| 33 | + defp asin_d(x), do: :math.asin(x) * 180.0 / :math.pi() | |
| 34 | 34 | defp atan2_d(y, x), do: :math.atan2(y, x) * 180.0 / :math.pi() |
| 35 | 35 | |
| 36 | 36 | defp norm_deg(deg) do |
| 44 | 44 | end |
| 45 | 45 | |
| 46 | 46 | defp moon_ra_dec(jd) do |
| 47 | − d = jd - 2451545.0 | |
| 48 | − ll = norm_deg(218.316 + 13.176396 * d) | |
| 49 | − mm = norm_deg(134.963 + 13.064993 * d) | |
| 50 | − ff = norm_deg(93.272 + 13.229350 * d) | |
| 47 | + d = jd - 2_451_545.0 | |
| 48 | + ll = norm_deg(218.316 + 13.176396 * d) | |
| 49 | + mm = norm_deg(134.963 + 13.064993 * d) | |
| 50 | + ff = norm_deg(93.272 + 13.229350 * d) | |
| 51 | 51 | lon = ll + 6.289 * sin_d(mm) |
| 52 | 52 | lat = 5.128 * sin_d(ff) |
| 53 | 53 | eps = 23.439 - 0.0000004 * d |
| 54 | − ra = atan2_d(sin_d(lon) * cos_d(eps) - tan_d(lat) * sin_d(eps), cos_d(lon)) | |
| 54 | + ra = atan2_d(sin_d(lon) * cos_d(eps) - tan_d(lat) * sin_d(eps), cos_d(lon)) | |
| 55 | 55 | dec = asin_d(sin_d(lat) * cos_d(eps) + cos_d(lat) * sin_d(eps) * sin_d(lon)) |
| 56 | 56 | {norm_deg(ra), dec} |
| 57 | 57 | end |
| 58 | 58 | |
| 59 | 59 | defp gmst_midnight(jd) do |
| 60 | − d = jd - 2451545.0 | |
| 60 | + d = jd - 2_451_545.0 | |
| 61 | 61 | t = d / 36525.0 |
| 62 | 62 | norm_deg(100.4606184 + 36000.77004 * t + 0.000387933 * t * t) |
| 63 | 63 | end |
| 64 | 64 | |
| 65 | 65 | # Returns {:ok, rise_ut_hours, set_ut_hours} or {:error, reason} |
| 66 | 66 | defp moon_rise_set_ut(date, lat, lon) do |
| 67 | − jd = jd_from_date(date) | |
| 67 | + jd = jd_from_date(date) | |
| 68 | 68 | {ra, dec} = moon_ra_dec(jd + 0.5) |
| 69 | − gmst = gmst_midnight(jd) | |
| 70 | − lst = norm_deg(gmst + lon) | |
| 71 | − cos_ha = (sin_d(0.125) - sin_d(lat) * sin_d(dec)) / (cos_d(lat) * cos_d(dec)) | |
| 69 | + gmst = gmst_midnight(jd) | |
| 70 | + lst = norm_deg(gmst + lon) | |
| 71 | + cos_ha = (sin_d(0.125) - sin_d(lat) * sin_d(dec)) / (cos_d(lat) * cos_d(dec)) | |
| 72 | 72 | |
| 73 | 73 | cond do |
| 74 | − cos_ha > 1.0 -> {:error, :circumpolar_below} | |
| 75 | − cos_ha < -1.0 -> {:error, :circumpolar_above} | |
| 74 | + cos_ha > 1.0 -> | |
| 75 | + {:error, :circumpolar_below} | |
| 76 | + | |
| 77 | + cos_ha < -1.0 -> | |
| 78 | + {:error, :circumpolar_above} | |
| 79 | + | |
| 76 | 80 | true -> |
| 77 | − ha = :math.acos(cos_ha) * 180.0 / :math.pi() | |
| 81 | + ha = :math.acos(cos_ha) * 180.0 / :math.pi() | |
| 78 | 82 | transit = norm_hours(norm_deg(ra - lst) / 15.0) |
| 79 | − rise = norm_hours(transit - ha / 15.0) | |
| 80 | − set = norm_hours(transit + ha / 15.0) | |
| 83 | + rise = norm_hours(transit - ha / 15.0) | |
| 84 | + set = norm_hours(transit + ha / 15.0) | |
| 81 | 85 | {:ok, rise, set} |
| 82 | 86 | end |
| 83 | 87 | end |
| 84 | 88 | |
| 85 | 89 | defp ut_to_local_time(date, ut_hours, tz) do |
| 86 | 90 | clamped = max(0.0, min(ut_hours, 23.9999)) |
| 87 | − h = trunc(clamped) | |
| 88 | − frac_m = (clamped - h) * 60.0 | |
| 89 | − m = trunc(frac_m) | |
| 90 | − s = trunc((frac_m - m) * 60.0) | |
| 91 | + h = trunc(clamped) | |
| 92 | + frac_m = (clamped - h) * 60.0 | |
| 93 | + m = trunc(frac_m) | |
| 94 | + s = trunc((frac_m - m) * 60.0) | |
| 91 | 95 | {:ok, ndt} = NaiveDateTime.new(date.year, date.month, date.day, h, m, s) |
| 92 | 96 | ndt |> DateTime.from_naive!("Etc/UTC") |> Timex.Timezone.convert(tz) |> DateTime.to_time() |
| 93 | 97 | end |
| 103 | 107 | |
| 104 | 108 | tz = WhereTZ.lookup(lat, lon) |
| 105 | 109 | {:ok, sunrise} = Solarex.Sun.rise(Date.utc_today(), lat, lon) |
| 106 | − {:ok, sunset} = Solarex.Sun.set(Date.utc_today(), lat, lon) | |
| 107 | − phase = Solarex.Moon.phase(Date.utc_today()) | |
| 110 | + {:ok, sunset} = Solarex.Sun.set(Date.utc_today(), lat, lon) | |
| 111 | + phase = Solarex.Moon.phase(Date.utc_today()) | |
| 108 | 112 | |
| 109 | 113 | moon_entries = |
| 110 | 114 | case moon_rise_set_ut(Date.utc_today(), lat, lon) do |
| 111 | 115 | {:ok, rise_h, set_h} -> |
| 112 | 116 | [ |
| 113 | 117 | %{period: :moonrise, result: ut_to_local_time(Date.utc_today(), rise_h, tz)}, |
| 114 | − %{period: :moonset, result: ut_to_local_time(Date.utc_today(), set_h, tz)} | |
| 118 | + %{period: :moonset, result: ut_to_local_time(Date.utc_today(), set_h, tz)} | |
| 115 | 119 | ] |
| 120 | + | |
| 116 | 121 | {:error, _} -> |
| 117 | 122 | [] |
| 118 | 123 | end |
| 138 | 143 | %{name: Configuration.place_name(query)} |
| 139 | 144 | ] ++ moon_entries |
| 140 | 145 | end |
| 141 | −end | |
| 146 | +end |
modified
apps/room_gbfs/lib/room_gbfs/gbfs_worker.ex
+88
−80
| 192 | 192 | ) |
| 193 | 193 | |
| 194 | 194 | :free_bike -> |
| 195 | + # v3 calls them vehicles and puts them under `vehicles`. | |
| 195 | 196 | data = |
| 196 | − # v3 calls them vehicles and puts them under `vehicles`. | |
| 197 | 197 | (Map.get(json.data, :bikes) || Map.get(json.data, :vehicles) || []) |
| 198 | 198 | |> Enum.map(&RoomGbfs.V3.vehicle_status/1) |
| 199 | 199 | |> Enum.map(fn x -> inj_iddt(x, id, dt) end) |
| 209 | 209 | |> inj_iddt(id, dt) |
| 210 | 210 | end) |
| 211 | 211 | |
| 212 | − | |
| 213 | 212 | RoomSanctum.Storage.truncate_free_bike_status(id) |
| 213 | + | |
| 214 | 214 | Repo.insert_all( |
| 215 | 215 | RoomSanctum.Storage.GBFS.V1.FreeBikeStatus, |
| 216 | 216 | data, |
| 231 | 231 | |> inj_iddt(id, dt) |
| 232 | 232 | end) |
| 233 | 233 | |
| 234 | − | |
| 235 | 234 | RoomSanctum.Storage.truncate_vehicle_types(id) |
| 235 | + | |
| 236 | 236 | Repo.insert_all( |
| 237 | 237 | RoomSanctum.Storage.GBFS.V1.VehicleTypes, |
| 238 | 238 | data, |
| 252 | 252 | |> inj_iddt(id, dt) |
| 253 | 253 | end) |
| 254 | 254 | |
| 255 | − | |
| 256 | 255 | RoomSanctum.Storage.truncate_system_pricing_plans(id) |
| 256 | + | |
| 257 | 257 | Repo.insert_all( |
| 258 | 258 | RoomSanctum.Storage.GBFS.V1.SystemPricingPlans, |
| 259 | 259 | data, |
| 266 | 266 | json.data.geofencing_zones.features |
| 267 | 267 | |> Enum.map(fn x -> inj_iddt(x, id, dt) end) |
| 268 | 268 | |> Enum.map(fn x -> |
| 269 | − point = %Geo.MultiPolygon{coordinates: x.geometry.coordinates , srid: 4326} | |
| 269 | + point = %Geo.MultiPolygon{coordinates: x.geometry.coordinates, srid: 4326} | |
| 270 | 270 | x |> Map.put(:place, point) |
| 271 | 271 | end) |
| 272 | − |> IO.inspect | |
| 272 | + |> IO.inspect() | |
| 273 | 273 | |> Enum.map(fn x -> |
| 274 | 274 | RoomSanctum.Storage.change_geo_fencing_zones( |
| 275 | 275 | %RoomSanctum.Storage.GBFS.V1.GeoFencingZones{}, |
| 277 | 277 | ).changes |
| 278 | 278 | |> inj_iddt(id, dt) |
| 279 | 279 | end) |
| 280 | − |> IO.inspect | |
| 281 | − | |
| 280 | + |> IO.inspect() | |
| 282 | 281 | |
| 283 | 282 | RoomSanctum.Storage.truncate_geo_fencing_zones(id) |
| 284 | −# Repo.insert_all( | |
| 285 | −# RoomSanctum.Storage.GBFS.V1.GeoFencingZones, | |
| 286 | −# data | |
| 287 | −# ) | |
| 283 | + | |
| 284 | + # Repo.insert_all( | |
| 285 | + # RoomSanctum.Storage.GBFS.V1.GeoFencingZones, | |
| 286 | + # data | |
| 287 | + # ) | |
| 288 | 288 | |
| 289 | 289 | :sys_hours -> |
| 290 | 290 | :ok |
| 316 | 316 | json.data.stations |
| 317 | 317 | |> Enum.map(fn x -> inj_iddt(x, id, dt) end) |
| 318 | 318 | |> Enum.map(fn x -> |
| 319 | − cs = RoomSanctum.Storage.change_ebikes_at_stations( | |
| 320 | − %RoomSanctum.Storage.GBFS.V1.EbikesAtStations{}, | |
| 321 | − x | |
| 322 | − ).changes | |
| 323 | − |> inj_iddt(id, dt) | |
| 324 | − | |
| 325 | − eb = cs.ebikes |> Enum.map(fn eb -> eb |> Ecto.Changeset.apply_changes end) | |
| 319 | + cs = | |
| 320 | + RoomSanctum.Storage.change_ebikes_at_stations( | |
| 321 | + %RoomSanctum.Storage.GBFS.V1.EbikesAtStations{}, | |
| 322 | + x | |
| 323 | + ).changes | |
| 324 | + |> inj_iddt(id, dt) | |
| 325 | + | |
| 326 | + eb = cs.ebikes |> Enum.map(fn eb -> eb |> Ecto.Changeset.apply_changes() end) | |
| 326 | 327 | cs |> Map.put(:ebikes, eb) |
| 327 | 328 | end) |
| 328 | 329 | |
| 329 | 330 | RoomSanctum.Storage.truncate_ebikes_at_stations(id) |
| 331 | + | |
| 330 | 332 | Repo.insert_all( |
| 331 | 333 | RoomSanctum.Storage.GBFS.V1.EbikesAtStations, |
| 332 | 334 | data, |
| 396 | 398 | # list the feeds in whatever order suits them. |
| 397 | 399 | |> Enum.sort_by(&RoomGbfs.V3.feed_order/1) |
| 398 | 400 | |> Enum.map(fn %{"name" => name, "url" => url} -> |
| 399 | − # v3 renamed the loose-vehicle feed; everything below is | |
| 400 | − # written in v2's names, which is the one dialect this worker | |
| 401 | − # speaks. | |
| 402 | − case RoomGbfs.V3.feed_name(name) do | |
| 403 | − "ebikes_at_stations" -> | |
| 404 | − write_data(url, :ebikes_at_stations, state.id, cfg.config.lang) | |
| 405 | − bcast(state.id, :system_information, 3, @tfh) | |
| 406 | − | |
| 407 | − "system_information" -> | |
| 408 | − write_data(url, :sys_info, state.id, cfg.config.lang) | |
| 409 | − bcast(state.id, :system_information, 4, @tfh) | |
| 410 | − | |
| 411 | − "station_information" -> | |
| 412 | − write_data(url, :stat_info, state.id, cfg.config.lang) | |
| 413 | − bcast(state.id, :system_information, 5, @tfh) | |
| 414 | − | |
| 415 | − "station_status" -> | |
| 416 | − write_data(url, :stat_status, state.id, cfg.config.lang) | |
| 417 | − bcast(state.id, :system_information, 6, @tfh) | |
| 418 | − | |
| 419 | − "free_bike_status" -> | |
| 420 | − write_data(url, :free_bike, state.id, cfg.config.lang) | |
| 421 | − bcast(state.id, :system_information, 7, @tfh) | |
| 422 | − | |
| 423 | − "system_hours" -> | |
| 424 | − write_data(url, :sys_hours, state.id, cfg.config.lang) | |
| 425 | − bcast(state.id, :system_information, 8, @tfh) | |
| 426 | − | |
| 427 | − "system_calendar" -> | |
| 428 | − write_data(url, :sys_cal, state.id, cfg.config.lang) | |
| 429 | − bcast(state.id, :system_information, 9, @tfh) | |
| 430 | − | |
| 431 | − "system_regions" -> | |
| 432 | − write_data(url, :sys_regions, state.id, cfg.config.lang) | |
| 433 | − bcast(state.id, :system_information, 10, @tfh) | |
| 434 | − | |
| 435 | − "system_alerts" -> | |
| 436 | − write_data(url, :sys_alerts, state.id, cfg.config.lang) | |
| 437 | − bcast(state.id, :system_alerts, 11, @tfh) | |
| 438 | − | |
| 439 | − "vehicle_types" -> | |
| 440 | − write_data(url, :vehicle_types, state.id, cfg.config.lang) | |
| 441 | − bcast(state.id, :vehicle_types, 12, @tfh) | |
| 442 | − | |
| 443 | − "system_pricing_plans" -> | |
| 444 | − write_data(url, :pricing_plans, state.id, cfg.config.lang) | |
| 445 | − bcast(state.id, :pricing_plans, 13, @tfh) | |
| 446 | − | |
| 447 | − "geofencing_zones" -> | |
| 448 | − write_data(url, :geofencing_zones, state.id, cfg.config.lang) | |
| 449 | − bcast(state.id, :geofencing_zones, 14, @tfh) | |
| 450 | − | |
| 451 | − otherwise -> | |
| 452 | − Logger.info("GBFS::#{state.id} System has unhandled file #{otherwise}") | |
| 453 | − end | |
| 454 | − end) | |
| 401 | + # v3 renamed the loose-vehicle feed; everything below is | |
| 402 | + # written in v2's names, which is the one dialect this worker | |
| 403 | + # speaks. | |
| 404 | + case RoomGbfs.V3.feed_name(name) do | |
| 405 | + "ebikes_at_stations" -> | |
| 406 | + write_data(url, :ebikes_at_stations, state.id, cfg.config.lang) | |
| 407 | + bcast(state.id, :system_information, 3, @tfh) | |
| 408 | + | |
| 409 | + "system_information" -> | |
| 410 | + write_data(url, :sys_info, state.id, cfg.config.lang) | |
| 411 | + bcast(state.id, :system_information, 4, @tfh) | |
| 412 | + | |
| 413 | + "station_information" -> | |
| 414 | + write_data(url, :stat_info, state.id, cfg.config.lang) | |
| 415 | + bcast(state.id, :system_information, 5, @tfh) | |
| 416 | + | |
| 417 | + "station_status" -> | |
| 418 | + write_data(url, :stat_status, state.id, cfg.config.lang) | |
| 419 | + bcast(state.id, :system_information, 6, @tfh) | |
| 420 | + | |
| 421 | + "free_bike_status" -> | |
| 422 | + write_data(url, :free_bike, state.id, cfg.config.lang) | |
| 423 | + bcast(state.id, :system_information, 7, @tfh) | |
| 424 | + | |
| 425 | + "system_hours" -> | |
| 426 | + write_data(url, :sys_hours, state.id, cfg.config.lang) | |
| 427 | + bcast(state.id, :system_information, 8, @tfh) | |
| 428 | + | |
| 429 | + "system_calendar" -> | |
| 430 | + write_data(url, :sys_cal, state.id, cfg.config.lang) | |
| 431 | + bcast(state.id, :system_information, 9, @tfh) | |
| 432 | + | |
| 433 | + "system_regions" -> | |
| 434 | + write_data(url, :sys_regions, state.id, cfg.config.lang) | |
| 435 | + bcast(state.id, :system_information, 10, @tfh) | |
| 436 | + | |
| 437 | + "system_alerts" -> | |
| 438 | + write_data(url, :sys_alerts, state.id, cfg.config.lang) | |
| 439 | + bcast(state.id, :system_alerts, 11, @tfh) | |
| 440 | + | |
| 441 | + "vehicle_types" -> | |
| 442 | + write_data(url, :vehicle_types, state.id, cfg.config.lang) | |
| 443 | + bcast(state.id, :vehicle_types, 12, @tfh) | |
| 444 | + | |
| 445 | + "system_pricing_plans" -> | |
| 446 | + write_data(url, :pricing_plans, state.id, cfg.config.lang) | |
| 447 | + bcast(state.id, :pricing_plans, 13, @tfh) | |
| 448 | + | |
| 449 | + "geofencing_zones" -> | |
| 450 | + write_data(url, :geofencing_zones, state.id, cfg.config.lang) | |
| 451 | + bcast(state.id, :geofencing_zones, 14, @tfh) | |
| 452 | + | |
| 453 | + otherwise -> | |
| 454 | + Logger.info("GBFS::#{state.id} System has unhandled file #{otherwise}") | |
| 455 | + end | |
| 456 | + end) | |
| 455 | 457 | |
| 456 | 458 | {:noreply, state} |
| 457 | 459 |
| 559 | 561 | |
| 560 | 562 | def sys_info_as_stats(id) do |
| 561 | 563 | s = Storage.get_sys_info!(:src, id) |
| 564 | + | |
| 562 | 565 | %{ |
| 563 | 566 | name: s.name, |
| 564 | 567 | start_date: s.start_date, |
| 565 | 568 | system_id: s.system_id, |
| 566 | 569 | operator: s.operator, |
| 567 | − tz: s.timezone, | |
| 570 | + tz: s.timezone | |
| 568 | 571 | } |
| 569 | 572 | end |
| 570 | 573 |
| 573 | 576 | stations: Storage.count_gbfs_stations(id), |
| 574 | 577 | slots: Storage.count_gbfs_slots(id), |
| 575 | 578 | bikes: Storage.count_gbfs_bikes(id), |
| 576 | − ebikes: Storage.count_gbfs_ebikes(id), | |
| 579 | + ebikes: Storage.count_gbfs_ebikes(id) | |
| 577 | 580 | } |
| 578 | 581 | end |
| 579 | 582 | |
| 580 | 583 | def free_stats(id) do |
| 581 | − details = Storage.count_free_bikes_types(id) |> Enum.map(fn %{cnt: cnt, ff: ff} -> {ff, cnt} end) |> Map.new |> IO.inspect | |
| 584 | + details = | |
| 585 | + Storage.count_free_bikes_types(id) | |
| 586 | + |> Enum.map(fn %{cnt: cnt, ff: ff} -> {ff, cnt} end) | |
| 587 | + |> Map.new() | |
| 588 | + |> IO.inspect() | |
| 589 | + | |
| 582 | 590 | %{ |
| 583 | 591 | free_bikes: Storage.count_free_bikes(id) |
| 584 | − } |> Map.merge(details) | |
| 585 | − | |
| 592 | + } | |
| 593 | + |> Map.merge(details) | |
| 586 | 594 | end |
| 587 | 595 | end |
modified
apps/room_github/lib/room_github/worker.ex
+19
−5
Click to load diff…
modified
apps/room_gitlab/lib/room_gitlab/gitlab_worker.ex
+18
−7
Click to load diff…
modified
apps/room_gtfs/lib/gtfs_realtime_pb.ex
+308
−238
Click to load diff…
modified
apps/room_gtfs/lib/room_gtfs/feed_tester.ex
+13
−4
Click to load diff…
modified
apps/room_gtfs/lib/room_gtfs/gtfs_worker.ex
+247
−137
Click to load diff…
modified
apps/room_hermes/lib/room_hermes/mail/imap.ex
+10
−3
Click to load diff…
modified
apps/room_hermes/lib/room_hermes/mail/imap_worker.ex
+4
−1
Click to load diff…
modified
apps/room_hermes/lib/room_hermes/mail/server.ex
+3
−1
Click to load diff…
modified
apps/room_hermes/lib/room_hermes/mail/smtp.ex
+5
−5
Click to load diff…
modified
apps/room_hermes/lib/room_hermes_web/controllers/resource_controller.ex
+1
−0
Click to load diff…
modified
apps/room_icarus/lib/room_icarus/worker.ex
+2
−0
Click to load diff…
modified
apps/room_packages/lib/room_packages/package_worker.ex
+3
−2
Click to load diff…
modified
apps/room_pollen/lib/room_pollen/worker.ex
+1
−3
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum/condensers/basic_mqtt.ex
+22
−18
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum/configuration.ex
+20
−9
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum/configuration/vision.ex
+26
−9
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum/queues/mail.ex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum/queues/webhooks.ex
+11
−3
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum/storage.ex
+113
−96
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum/workers/ankyra_worker.ex
+19
−5
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum/workers/keryx_item_cache.ex
+126
−87
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum/workers/keryx_worker.ex
+92
−45
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum/workers/plani_worker.ex
+5
−2
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum/workers/vision_worker.ex
+1
−2
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/components/query_geospatial_map.ex
+185
−126
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/controllers/data_controller.ex
+23
−22
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_foci_live/form_component_coords.ex
+26
−15
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_pythiae_live/form_component.ex
+5
−4
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_pythiae_live/public.ex
+9
−3
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_pythiae_live/show.ex
+8
−2
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_query_live/index.ex
+172
−145
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_query_live/show.ex
+87
−65
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_scribus_live/public.ex
+23
−23
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_source_live/form_component.ex
+33
−13
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_source_live/index.ex
+58
−41
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_source_live/show.ex
+215
−147
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/helpers/map_streaming.ex
+51
−48
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/keryx_live/form_component.ex
+11
−8
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/landing_live/index.ex
+5
−4
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/live_preview.ex
+41
−19
Click to load diff…
modified
apps/room_sanctum/test/room_sanctum/gbfs_query_test.exs
+1
−1
Click to load diff…
modified
apps/room_sanctum/test/room_sanctum/query_cache_test.exs
+12
−2
Click to load diff…
modified
apps/room_scribes/lib/room_scribes/scribe_worker.ex
+29
−21
Click to load diff…
modified
apps/room_scribes/lib/room_scribes/scribus_timer.ex
+13
−9
Click to load diff…
Parents: 3234b45