<p></p>
<p><b>@nenad-vujicic</b> commented on this pull request.</p>
<hr>
<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5667#discussion_r1963254667">db/migrate/20250212160355_backfill_note_descriptions.rb</a>:</p>
<pre style='color:#555'>> + note_ids = notes.pluck(:id)
+
+ sql_query = <<-SQL.squish
+ WITH first_comment AS(
+ SELECT DISTINCT ON (note_id) *
+ FROM note_comments
+ WHERE note_id BETWEEN #{note_ids.min} AND #{note_ids.max}
+ ORDER BY note_id, id
+ )
+ UPDATE notes
+ SET description = first_comment.body,
+ user_id = first_comment.author_id,
+ user_ip = first_comment.author_ip
+ FROM first_comment
+ WHERE first_comment.note_id = notes.id
+ AND first_comment.event = 'opened';
</pre>
<p dir="auto">We have proposal for supporting notes with a missing opening comment (and generally all comments) in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2864480905" data-permission-text="Title is private" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/5712" data-hovercard-type="pull_request" data-hovercard-url="/openstreetmap/openstreetmap-website/pull/5712/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/pull/5712">#5712</a>. Do we have other special cases we should support before this?</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5667#discussion_r1963254667">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLILPDD2I623ZE6BZID2QWR4VAVCNFSM6AAAAABXCOPTA2VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDMMRZGMZTKOJVGA">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLJGOUDYAIQFP2WI5W32QWR4VA5CNFSM6AAAAABXCOPTA2WGG33NNVSW45C7OR4XAZNRKB2WY3CSMVYXKZLTORJGK5TJMV32UY3PNVWWK3TUL5UWJTU4XB5Y4.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/5667/review/2629335950</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/5667#discussion_r1963254667",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/5667#discussion_r1963254667",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>