Add a credit to the statistics.
(&mut self, credit: &Credit)
| 466 | |
| 467 | /// Add a credit to the statistics. |
| 468 | pub fn add(&mut self, credit: &Credit) { |
| 469 | self.total_lines += 1; |
| 470 | |
| 471 | match credit.credit_type { |
| 472 | CreditType::Human => self.human_lines += 1, |
| 473 | CreditType::AiAssisted => self.ai_assisted_lines += 1, |
| 474 | CreditType::Collaborative => self.collaborative_lines += 1, |
| 475 | CreditType::AiGenerated => self.ai_generated_lines += 1, |
| 476 | CreditType::Unknown => self.unknown_lines += 1, |
| 477 | } |
| 478 | |
| 479 | if let Some(ref vendor) = credit.ai_vendor { |
| 480 | let vendor_name = vendor.name().to_string(); |
| 481 | if !self.ai_vendors.contains(&vendor_name) { |
| 482 | self.ai_vendors.push(vendor_name); |
| 483 | } |
| 484 | } |
| 485 | } |
| 486 | |
| 487 | /// Get the percentage of lines involving AI. |
| 488 | pub fn ai_percentage(&self) -> f64 { |