Coffee journaling on ATProto (alpha) alpha.arabica.social
coffee

fix: sum pour water amounts when water amount not set

On brew view page, if WaterAmount is 0 but pours exist,
calculate and display the sum of all pour water amounts.

pdewey.com c19f4a85 e217109b

verified
+14 -3
+12 -1
internal/bff/render.go
··· 247 247 return err 248 248 } 249 249 250 + // If water amount is not set but pours exist, sum the pours 251 + displayBrew := brew 252 + if brew.WaterAmount == 0 && len(brew.Pours) > 0 { 253 + // Create a copy to avoid modifying the original 254 + brewCopy := *brew 255 + for _, pour := range brew.Pours { 256 + brewCopy.WaterAmount += pour.WaterAmount 257 + } 258 + displayBrew = &brewCopy 259 + } 260 + 250 261 brewData := &BrewData{ 251 - Brew: brew, 262 + Brew: displayBrew, 252 263 PoursJSON: PoursToJSON(brew.Pours), 253 264 } 254 265
+1 -1
templates/partials/feed.tmpl
··· 50 50 </div> 51 51 {{if and .Brew.Bean.Roaster .Brew.Bean.Roaster.Name}} 52 52 <div class="text-sm text-brown-700 mt-0.5"> 53 - <span class="font-medium">🏪 {{.Brew.Bean.Roaster.Name}}</span> 53 + <span class="font-medium">🏭 {{.Brew.Bean.Roaster.Name}}</span> 54 54 </div> 55 55 {{end}} 56 56 <div class="text-xs text-brown-600 mt-1 flex flex-wrap gap-x-2 gap-y-0.5">
+1 -1
templates/partials/profile_content.tmpl
··· 75 75 <!-- Roasters --> 76 76 {{if .Roasters}} 77 77 <div> 78 - <h3 class="text-lg font-semibold text-brown-900 mb-3">🏪 Favorite Roasters</h3> 78 + <h3 class="text-lg font-semibold text-brown-900 mb-3">🏭 Favorite Roasters</h3> 79 79 <div class="overflow-x-auto bg-gradient-to-br from-brown-100 to-brown-200 rounded-xl shadow-xl border border-brown-300"> 80 80 <table class="min-w-full divide-y divide-brown-300"> 81 81 <thead class="bg-brown-200/80">