MCPcopy Create free account
hub / github.com/FSGModding/FSG_Mod_Assistant / updateFromData

Method updateFromData

renderer/renderJS/main_ui_lib.js:136–224  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

134 }
135 // MARK: process data
136 async updateFromData(data) {
137 window.data = data
138 this.#updateTracking(data)
139
140 for ( const [CIndex, CKey] of Object.entries([...data.set_Collections]) ) {
141 if ( !data.collectionNotes[CKey].notes_holding && data.collectionNotes[CKey].notes_version !== this.flag.currentVersion ) { continue }
142
143 this.orderMap.keys.push(CKey)
144 this.orderMap.keyToNum[CKey] = parseInt(CIndex)
145 this.orderMap.numToKey[CIndex] = CKey
146 this.orderMap.max = Math.max(this.orderMap.max, parseInt(CIndex))
147
148 this.mapCollectionDropdown.set(CKey, data.modList[CKey].fullName)
149 this.mapCollectionFiles.set(CKey, {
150 color : data.collectionNotes[CKey].notes_color,
151 folder : data.collectionToFolderRelative[CKey],
152 name : data.modList[CKey].name,
153 tag : data.collectionNotes[CKey].notes_tagline,
154 })
155
156 // eslint-disable-next-line no-await-in-loop
157 const thisCol = await this.#addCollection(CKey, data.modList[CKey], data.collectionNotes[CKey], data.collectionToStatus[CKey])
158 this.collections[CKey] = thisCol
159
160 if ( !this.flag.folderEdit ) {
161 this.mods[CKey] = {}
162
163 for ( const [MKey, thisMod] of Object.entries(data.modList[CKey].mods) ) {
164 const thisModName = thisMod.fileDetail.shortName
165
166 // eslint-disable-next-line no-await-in-loop
167 const thisModRec = await this.#addMod(thisMod, this.getSaveBadges(CKey, thisMod), data.collectionNotes[CKey].notes_holding)
168
169 for ( const tag of thisModRec.filters ) { this.searchTagList.add(tag) }
170
171 thisCol.sorter.push([
172 /* 0 */ MKey,
173 /* 1 */ thisModRec.search.find_name,
174 /* 2 */ thisModRec.search.find_author,
175 /* 3 */ thisModRec.search.find_title,
176 /* 4 */ thisModRec.search.find_version,
177 /* 5 */ thisMod.fileDetail.fileDate,
178 /* 6 */ thisMod.fileDetail.fileSize,
179 /* 7 */ this.emptySort(thisModRec.search.find_brand),
180 /* 8 */ this.emptySort(thisModRec.search.find_cats)
181 ])
182
183 this.mods[CKey][MKey] = thisModRec
184
185 if ( thisModRec.filters.has('map') ) {
186 thisCol.mapList.push({
187 icon : thisMod.modDesc.iconImage,
188 key : thisMod.colUUID,
189 title : thisMod.fileDetail.shortName,
190 })
191 }
192
193 if ( thisCol.notes.notes_frozen ) { continue }

Callers

nothing calls this directly

Calls 15

#updateTrackingMethod · 0.95
#addCollectionMethod · 0.95
#addModMethod · 0.95
getSaveBadgesMethod · 0.95
emptySortMethod · 0.95
updateVerPickMethod · 0.95
updateUIMethod · 0.95
fixSortsMethod · 0.95
doDisplayMethod · 0.95
colScrollMethod · 0.95

Tested by

no test coverage detected