Change TEXT to INTEGER in card_stats
This commit is contained in:
1 parent
e8c9e37ca1
commit
1406fc8f21
5 files changed
+43
-34
No files matched your search
+22
-18
@@ -40,25 +40,29 @@ pub fn load_groups(connection: &Connection) -> ImportData {
|
||||
.collect::<Vec<(i64, i64)>>();
|
||||
|
||||
for (_, collection) in sets {
|
||||
let fields = collection["flds"]
|
||||
.as_array()
|
||||
.unwrap()
|
||||
.iter()
|
||||
.map(|x| x["name"].as_str().unwrap().to_string())
|
||||
.collect();
|
||||
let mut group = ImportGroup {
|
||||
id: collection["id"].as_u64().unwrap(),
|
||||
name: collection["name"].as_str().unwrap().to_string(),
|
||||
fields,
|
||||
mapping: Default::default(),
|
||||
length: 0,
|
||||
imported: false,
|
||||
};
|
||||
if let Some((_, count)) = counts.iter().find(|(id, _)| *id == group.id as i64) {
|
||||
group.length = *count as u64
|
||||
let fields_property = collection.get("fields");
|
||||
if let Some(fields_property) = fields_property {
|
||||
let fields = fields_property
|
||||
.as_array()
|
||||
.unwrap()
|
||||
.iter()
|
||||
.map(|x| x["name"].as_str().unwrap().to_string())
|
||||
.collect();
|
||||
let mut group = ImportGroup {
|
||||
id: collection["id"].as_u64().unwrap(),
|
||||
name: collection["name"].as_str().unwrap().to_string(),
|
||||
fields,
|
||||
mapping: Default::default(),
|
||||
length: 0,
|
||||
imported: false,
|
||||
};
|
||||
if let Some((_, count)) = counts.iter().find(|(id, _)| *id == group.id as i64) {
|
||||
group.length = *count as u64
|
||||
}
|
||||
println!("{:?}", group);
|
||||
total_data.0.push(group);
|
||||
}
|
||||
println!("{:?}", group);
|
||||
total_data.0.push(group);
|
||||
|
||||
}
|
||||
total_data
|
||||
}
|
||||
|
||||
@@ -17,9 +17,7 @@ pub fn create_db() {
|
||||
}
|
||||
}
|
||||
|
||||
fn ensure_db_schema(connection: &Connection) {
|
||||
|
||||
}
|
||||
fn ensure_db_schema(_: &Connection) {}
|
||||
|
||||
fn create_tables(conn: &Connection) {
|
||||
make_card_set(conn).unwrap();
|
||||
|
||||
Reference in new issue
Block a user