Follow-up bc5b24e3ad : ConfigWizard: Fixed compatible printer counter for materials

This commit is contained in:
YuSanka 2023-11-16 10:59:11 +01:00
parent 0e1a0e856f
commit 3d438ea93a
2 changed files with 4 additions and 4 deletions

View File

@ -2603,7 +2603,7 @@ void ConfigWizard::priv::update_materials(Technology technology)
} }
if (printer) { if (printer) {
materials.add_printer(printer); materials.add_printer(printer);
materials.compatibility_counter[preset.alias]++; materials.compatibility_counter[preset.alias].insert(printer);
} }
}; };

View File

@ -323,8 +323,8 @@ struct Materials
Technology technology; Technology technology;
// use vector for the presets to purpose of save of presets sorting in the bundle // use vector for the presets to purpose of save of presets sorting in the bundle
std::vector<const Preset*> presets; std::vector<const Preset*> presets;
// String is alias of material, size_t number of compatible printers counters // String is alias of material, set is set of compatible printers
std::map<std::string, size_t> compatibility_counter; std::map<std::string, std::set<const Preset*>> compatibility_counter;
std::set<std::string> types; std::set<std::string> types;
std::set<const Preset*> printers; std::set<const Preset*> printers;
@ -358,7 +358,7 @@ struct Materials
size_t get_printer_counter(const Preset* preset) { size_t get_printer_counter(const Preset* preset) {
for (auto it : compatibility_counter) { for (auto it : compatibility_counter) {
if (it.first == preset->alias) if (it.first == preset->alias)
return it.second; return it.second.size();
} }
return 0; return 0;
} }