mirror of
https://github.com/atsunatsu/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
feat(radar): 生成通联记录帖子只含当前过境窗口
generatePost 的筛选从最近 24 小时改为当前过境窗口(aos..los), 与日志列表 recent 同一套过滤逻辑,不再混入其他过境的 QSO
This commit is contained in:
1 parent
a2b3ce5d69
commit
b48e23804f
2 files changed
+5
-5
No files matched your search
@@ -178,7 +178,7 @@ fun LogPage(
|
||||
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(6.dp), modifier = Modifier.fillMaxWidth()) {
|
||||
OutlinedButton(
|
||||
onClick = { logViewModel.generatePost(satName, maxElev) },
|
||||
onClick = { logViewModel.generatePost(satName, maxElev, passWindow) },
|
||||
enabled = recent.isNotEmpty(),
|
||||
modifier = Modifier.weight(1f)
|
||||
) { Text("生成通联记录", fontSize = 13.sp) }
|
||||
|
||||
@@ -142,16 +142,16 @@ class LogViewModel(
|
||||
*/
|
||||
fun updateRecord(record: QsoRecord) = viewModelScope.launch { qsoRepository.save(record) }
|
||||
|
||||
/** English social post from the recorded QSOs of the current satellite (last 24h). */
|
||||
fun generatePost(satName: String, maxElev: Double) {
|
||||
/** English social post from the recorded QSOs of the current satellite.
|
||||
* Same window logic as the on-screen list: only the current pass (aos..los). */
|
||||
fun generatePost(satName: String, maxElev: Double, passWindow: ClosedRange<Long>?) {
|
||||
viewModelScope.launch {
|
||||
val now = System.currentTimeMillis()
|
||||
// Records carry the ARRL name while the pass carries the tracker's name, so the
|
||||
// operator's own contacts are collected by identity, not by the raw name.
|
||||
val identity = satelliteIdentity(satName)
|
||||
val list = qsoRepository.records.first()
|
||||
.filter { satelliteIdentity(it.satelliteName) == identity }
|
||||
.filter { it.startUtcMillis > now - 24 * 3_600_000L }
|
||||
.filter { passWindow?.contains(it.startUtcMillis) == true }
|
||||
.sortedBy { it.startUtcMillis }
|
||||
if (list.isEmpty()) return@launch
|
||||
val shortName = officialSatelliteName(satName).substringBefore('(').trim().uppercase(Locale.US)
|
||||
|
||||
Reference in new issue
Block a user