Don't track updates for uninstalled apps

Also clean up the funtion a bit
This commit is contained in:
Pk11
2021-05-01 19:58:46 -05:00
parent 376201c17e
commit 11238eea22
+6 -8
View File
@@ -79,18 +79,16 @@ public:
/* Remove installed state from a download list entry. */ /* Remove installed state from a download list entry. */
void RemoveInstalled(const std::string &unistoreName, const std::string &entry, const std::string &name) { void RemoveInstalled(const std::string &unistoreName, const std::string &entry, const std::string &name) {
const std::vector<std::string> installs = this->GetInstalled(unistoreName, entry); const std::vector<std::string> installs = this->GetInstalled(unistoreName, entry);
int idx = -1; if (installs.empty()) return;
if (!installs.empty()) { for (int i = 0; i < (int)installs.size(); i++) {
for (int i = 0; i < (int)installs.size(); i++) { if (installs[i] == name) {
if (installs[i] == name) { this->metadataJson[unistoreName][entry]["installed"].erase(i);
idx = i; break;
break;
}
} }
} }
if (idx != -1) this->metadataJson[unistoreName][entry]["installed"].erase(idx); if (this->metadataJson[unistoreName][entry]["installed"].empty() && this->metadataJson[unistoreName][entry].contains("updated")) this->metadataJson[unistoreName][entry].erase("updated");
} }
void ImportMetadata(); void ImportMetadata();