Skip to content

Commit

Permalink
Makes large req export histories more readable and less laggy (#16213)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ldip999 authored Jul 2, 2024
1 parent bb57b2e commit 60d8d41
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 8 additions & 2 deletions code/modules/reqs/supply.dm
Original file line number Diff line number Diff line change
Expand Up @@ -370,11 +370,17 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
.["awaiting_delivery"] += list(list("id" = SO.id, "orderer" = SO.orderer, "orderer_rank" = SO.orderer_rank, "reason" = SO.reason, "packs" = packs, "authed_by" = SO.authorised_by))
.["export_history"] = list()
var/id = 0
var/lastexport = ""
for(var/datum/export_report/report AS in SSpoints.export_history)
if(report.faction != user.faction)
continue
.["export_history"] += list(list("id" = id, "name" = report.export_name, "points" = report.points))
id++
if(report.export_name == lastexport)
.["export_history"][id]["amount"] += 1
.["export_history"][id]["total"] += report.points
else
.["export_history"] += list(list("id" = id, "name" = report.export_name, "points" = report.points, "amount" = 1, total = report.points))
id++
lastexport = report.export_name
.["shopping_history"] = list()
for(var/datum/supply_order/SO AS in SSpoints.shopping_history)
if(SO.faction != user.faction)
Expand Down
4 changes: 3 additions & 1 deletion tgui/packages/tgui/interfaces/Cargo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ const Exports = (props) => {
{export_history.map((exp) => (
<Table.Row key={exp.id}>
<Table.Cell>{exp.name}</Table.Cell>
<Table.Cell>{exp.points} points</Table.Cell>
<Table.Cell>
{exp.amount} x {exp.points} points ({exp.total})
</Table.Cell>
</Table.Row>
))}
</Table>
Expand Down

0 comments on commit 60d8d41

Please sign in to comment.