feat: include bonus
This commit is contained in:
16 files changed
+773
-83
No files matched your search
+4
-10
@@ -511,20 +511,14 @@ pub fn describe(intake: &FormIntake) -> String {
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// `true` when it holds at least one file named like `1.csv`.
|
||||
/// `true` when it holds at least one file named like `1.csv` or `1_Title.csv`.
|
||||
pub fn looks_like_export(dir: &Path) -> bool {
|
||||
let Ok(entries) = std::fs::read_dir(dir) else {
|
||||
return false;
|
||||
};
|
||||
entries.filter_map(|e| e.ok()).any(|entry| {
|
||||
let path = entry.path();
|
||||
path.extension().and_then(|e| e.to_str()) == Some("csv")
|
||||
&& path
|
||||
.file_stem()
|
||||
.and_then(|s| s.to_str())
|
||||
.map(|s| s.chars().all(|c| c.is_ascii_digit()))
|
||||
.unwrap_or(false)
|
||||
})
|
||||
entries
|
||||
.filter_map(|e| e.ok())
|
||||
.any(|entry| gradescope::question_number(&entry.path()).is_some())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in new issue
Block a user