1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use super::QcOpts;
use rinex::prelude::{Rinex, SV};

use horrorshow::{box_html, RenderBox};
use rinex_qc_traits::HtmlReport;

#[derive(Debug, Clone)]
pub struct QcSvAnalysis {
    pub sv: Vec<SV>,
}

use itertools::Itertools;

impl QcSvAnalysis {
    pub fn new(primary: &Rinex, _opts: &QcOpts) -> Self {
        let sv: Vec<_> = primary.sv().collect();
        Self { sv }
    }
}

impl HtmlReport for QcSvAnalysis {
    fn to_html(&self) -> String {
        panic!("sv analysis cannot be rendered on its own")
    }
    fn to_inline_html(&self) -> Box<dyn RenderBox + '_> {
        box_html! {
            tr {
                th {
                    : "PRN#"
                }
                td {
                    p {
                        @ for mut chunks in &self.sv.iter().chunks(12) {
                            p {
                                @ while let Some(sv) = chunks.next() {
                                    : format!("{:x}, ", sv)
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}