Compare commits

..

2 Commits

Author SHA1 Message Date
b0txec a6b2b8462c Fix Faktiskā showing blank temperatures right after each new hour starts
CI / backend (push) Successful in 1m37s
CI / frontend (push) Successful in 48s
queryLatestTemperatures picked the single most-recent row per city with no
regard for whether that row's tempAvg was actually populated yet. The
open-data source publishes fields on different schedules within the same
hour (snow lands well before the hourly temperature aggregate), so the
freshest row for a city routinely has a real dateTime but a still-null
tempAvg while the previous hour's row has good data. Confirmed live on both
Rocky and the VPS: every city's newest row had tempAvg null (but a real
snowAvg=0), one hour after the actual last real reading.

Fixed by requiring tempAvg IS NOT NULL in the WHERE clause, so DISTINCT ON's
"most recent" pick skips a fresh partial row and finds the newest row that
actually has a value. Checked before changing: this is the only caller of
queryLatestTemperatures (Faktiskā's fixed-station lookup); a city with zero
real temperature history ever now returns no row instead of a null-valued
one, which the frontend already treats identically to a present-but-null
observation (falls through to the same "Nav datu" missing state either
way) -- confirmed via MapGraphics.tsx before shipping, not assumed.
2026-08-25 17:13:20 +03:00
b0txec 829319edf8 Polish hover/focus states on inputs and checkboxes, drop a stray font override
- Add a .secondary button variant and hover/focus states (border-color,
  focus ring) to text/number/date/select inputs, matching the existing
  checkbox and button interaction language.
- Restyle Brīdinājumi's warning checkbox to match the same custom-checkbox
  look already used elsewhere (border-based, hover, focus-visible outline)
  instead of its own older shadow-based style.
- Remove a hardcoded Inter font-family on Faktiskā's reset-temperature
  button so it inherits the app's default Monda font like everything else.
2026-08-25 17:13:11 +03:00
4 changed files with 16 additions and 4 deletions
+7
View File
@@ -29,10 +29,17 @@ object PostgresService {
class PostgresService(transactor: Transactor[IO], log: Logger[IO]) {
def queryLatestTemperatures(cities: NonEmptyList[String]): IO[List[(String, LocalDateTime, Option[Double])]] = {
// The open-data source publishes fields on different schedules within
// the same hour (e.g. snow arrives well before the hourly temperature
// aggregate), so the single newest row for a city can have a real
// dateTime but a still-null tempAvg. Skip straight to DISTINCT ON's
// "most recent" pick by requiring tempAvg itself to be present, so a
// fresh partial row never hides an older row that actually has data.
val query =
fr"SELECT DISTINCT ON (city) city, dateTime, tempAvg" ++
fr" FROM weather" ++
fr" WHERE " ++ Fragments.in(fr"city", cities) ++
fr" AND tempAvg IS NOT NULL" ++
fr" ORDER BY city, dateTime DESC"
query.query[(String, LocalDateTime, Option[Double])]
+4 -1
View File
@@ -49,10 +49,13 @@ thead {
}
.primary{background:var(--accent);color:#fff}.primary:hover{background:var(--accent-strong)}
.secondary{background:var(--surface);color:var(--accent-strong);border-color:var(--accent-soft)}.secondary:hover{background:var(--accent-pale);border-color:var(--accent)}
button,input[type=button]{transition:transform 260ms cubic-bezier(.23,1,.32,1),box-shadow 260ms,background-color 180ms,border-color 180ms;touch-action:manipulation;will-change:transform}button:not(:disabled):hover,input[type=button]:not(:disabled):hover{transform:translateY(-2px);box-shadow:0 8px 16px rgba(26,74,128,.16)}button:not(:disabled):active,input[type=button]:not(:disabled):active{transform:translateY(0);box-shadow:none}
input[type=checkbox]{--checkbox-size:18px;appearance:none;width:var(--checkbox-size);height:var(--checkbox-size);margin:0 6px 0 0;vertical-align:-3px;border:1px solid #aebed1;border-radius:5px;background:#fff;cursor:pointer;position:relative;transition:all .25s}input[type=checkbox]:hover{border-color:var(--accent)}input[type=checkbox]:checked{border-color:transparent;background:linear-gradient(145deg,#3388d7,#1763aa);box-shadow:0 0 0 3px rgba(36,119,197,.13)}input[type=checkbox]:checked:before{content:"";position:absolute;top:45%;left:50%;width:4px;height:8px;border-right:2px solid #fff;border-bottom:2px solid #fff;transform:translate(-50%,-50%) rotate(45deg) scale(1);animation:check-pop .22s cubic-bezier(.12,.4,.29,1.46)}input[type=checkbox]:focus-visible{outline:3px solid var(--accent-soft);outline-offset:2px}@keyframes check-pop{from{opacity:0;transform:translate(-50%,-50%) rotate(45deg) scale(0)}to{opacity:1;transform:translate(-50%,-50%) rotate(45deg) scale(1)}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}
input[type=text],input[type=number],input[type=date],input[type=datetime-local],select{min-height:38px;padding:7px 10px;border:1px solid #cfd7e2;border-radius:8px;background:#fff;font-family:inherit}button:disabled,input:disabled{cursor:not-allowed;opacity:.48}.appContent{min-height:calc(100vh - 73px);padding-inline:clamp(16px,3vw,48px)}
input[type=text],input[type=number],input[type=date],input[type=datetime-local],select{min-height:38px;padding:7px 10px;border:1px solid #cfd7e2;border-radius:8px;background:#fff;font-family:inherit;transition:border-color 180ms,box-shadow 180ms}
input[type=text]:hover,input[type=number]:hover,input[type=date]:hover,input[type=datetime-local]:hover,select:hover{border-color:var(--accent-soft)}
input[type=text]:focus,input[type=number]:focus,input[type=date]:focus,input[type=datetime-local]:focus,select:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px rgba(36,119,197,.15)}button:disabled,input:disabled{cursor:not-allowed;opacity:.48}.appContent{min-height:calc(100vh - 73px);padding-inline:clamp(16px,3vw,48px)}
table td {
padding: 3px 7px;
+1 -1
View File
@@ -25,7 +25,7 @@
.temperatureField.missing{border-style:dashed}
.temperatureFieldHeading{grid-area:heading;min-width:0}.temperatureFieldHeading strong,.temperatureFieldHeading small{display:block}.temperatureFieldHeading small{margin-top:2px;color:var(--text-muted);font-size:10px}
.temperatureInput{grid-area:input;display:flex;align-items:center;gap:7px}.temperatureInput input{width:100%;min-width:0;font-size:19px;font-weight:700}.temperatureInput>span{color:var(--text-muted);font-weight:700}
.resetTemperature{grid-area:reset;align-self:start;min-height:0;padding:3px 5px;background:transparent;color:var(--accent-strong);font-family:Inter,sans-serif;font-size:10px}
.resetTemperature{grid-area:reset;align-self:start;min-height:0;padding:3px 5px;background:transparent;color:var(--accent-strong);font-size:10px}
.inlineNotice{margin:10px 0;padding:10px 12px;border-radius:9px;background:rgba(255,255,255,.62)}.inlineNotice.error{color:var(--danger)}
.faktiskaProduction{margin-top:20px}.faktiskaProduction>h2{font-size:22px}
.faktiskaResolutionChoices{display:flex;gap:8px;margin:0 0 14px}.faktiskaResolutionChoices button{min-width:150px}.faktiskaResolutionChoices button.active{border-color:var(--accent);background:var(--accent-pale);color:var(--accent-strong)}
+4 -2
View File
@@ -23,10 +23,12 @@
.warningCheckboxLabel{position:relative;display:inline-flex;flex:0 0 auto;width:22px;height:22px;cursor:pointer}
.warningCheckboxLabel .warningCheckboxInput{position:absolute;opacity:0;height:0;width:0;margin:0}
.warningCheckmark{position:absolute;inset:0;background-color:#eee;border-radius:5px;transition:background-color .3s;box-shadow:0 2px 5px rgba(0,0,0,.2)}
.warningCheckmark{position:absolute;inset:0;background:#fff;border:1px solid #aebed1;border-radius:5px;transition:all .25s}
.warningCheckmark:after{content:"";position:absolute;display:none;left:7px;top:3px;width:5px;height:10px;border:solid #fff;border-width:0 3px 3px 0;transform:rotate(45deg)}
.warningCheckboxInput:checked ~ .warningCheckmark{background-color:#2196F3;box-shadow:0 3px 7px rgba(33,150,243,.3)}
.warningCheckboxLabel:hover .warningCheckmark{border-color:var(--accent)}
.warningCheckboxInput:checked ~ .warningCheckmark{border-color:transparent;background:linear-gradient(145deg,#3388d7,#1763aa);box-shadow:0 0 0 3px rgba(36,119,197,.13)}
.warningCheckboxInput:checked ~ .warningCheckmark:after{display:block;animation:warningCheckAnim .2s forwards}
.warningCheckboxInput:focus-visible ~ .warningCheckmark{outline:3px solid var(--accent-soft);outline-offset:2px}
@keyframes warningCheckAnim{0%{height:0}100%{height:10px}}
.warningBackdrop{position:fixed;inset:0;z-index:1000;display:flex;align-items:center;justify-content:center;padding:24px;background:rgba(10,20,35,.55);backdrop-filter:blur(6px);animation:warningFadeIn 180ms ease}