Skip to content

Commit

Permalink
Allow deleted for bank transfers sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
xdnw committed Jul 23, 2024
1 parent 3663a33 commit 82f4c60
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ dependencies {
runtimeOnly "ai.djl.pytorch:pytorch-engine:0.28.0"
runtimeOnly "ai.djl.pytorch:pytorch-model-zoo:0.28.0"
implementation "ai.djl.huggingface:tokenizers:0.28.0"
// runtimeOnly 'ai.djl.pytorch:pytorch-native-cu121:2.2.2:win-x86_64'
runtimeOnly 'ai.djl.pytorch:pytorch-native-cu121:2.2.2:win-x86_64'
runtimeOnly 'ai.djl.pytorch:pytorch-jni:2.2.2-0.28.0'
// implementation 'net.sourceforge.tess4j:tess4j:4.5.1'
implementation 'org.bytedeco:javacv:1.5.6'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -683,8 +683,9 @@ public static NationOrAllianceOrGuildOrTaxid nationOrAllianceOrGuildOrTaxId(Stri
return selfDb;
}
}
boolean allowDeleted = data != null && data.getAnnotation(AllowDeleted.class) != null;
try {
return nationOrAlliance(input, data);
return nationOrAlliance(data, input, allowDeleted);
} catch (IllegalArgumentException ignore) {
if (includeTaxId && !input.startsWith("#") && input.contains("tax_id")) {
int taxId = PW.parseTaxId(input);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2655,7 +2655,7 @@ public void largest(Map<ResourceType, Double> total, Map<ResourceType, Double> l

@Command(desc = "Get a sheet of in-game transfers for nations")
@RolePermission(value = Roles.ECON)
public String getIngameNationTransfers(@Me IMessageIO channel, @Me GuildDB db, Set<NationOrAlliance> senders, Set<NationOrAlliance> receivers, @Arg("Only transfers after timeframe") @Default("%epoch%") @Timestamp long timeframe, @Switch("s") SpreadSheet sheet) throws IOException, GeneralSecurityException {
public String getIngameNationTransfers(@Me IMessageIO channel, @Me GuildDB db, @AllowDeleted Set<NationOrAlliance> senders, @AllowDeleted Set<NationOrAlliance> receivers, @Arg("Only transfers after timeframe") @Default("%epoch%") @Timestamp long timeframe, @Switch("s") SpreadSheet sheet) throws IOException, GeneralSecurityException {
if (sheet == null) sheet = SpreadSheet.create(db, SheetKey.BANK_TRANSACTION_SHEET);
Set<Long> senderIds = senders.stream().map(NationOrAllianceOrGuild::getIdLong).collect(Collectors.toSet());
Set<Long> receiverIds = receivers.stream().map(NationOrAllianceOrGuild::getIdLong).collect(Collectors.toSet());
Expand Down Expand Up @@ -2800,7 +2800,7 @@ public String convertNegativeDeposits(@Me IMessageIO channel, @Me GuildDB db, @M
})
@RolePermission(value = Roles.ECON)
public String getNationsInternalTransfers(@Me IMessageIO channel, @Me GuildDB db,
Set<DBNation> nations,
@AllowDeleted Set<DBNation> nations,
@Arg(value = "Only list transfers after this time", group = 0)
@Timestamp @Default Long startTime,
@Arg(value = "Only list transfers before this time", group = 0)
Expand All @@ -2826,7 +2826,11 @@ public String getNationsInternalTransfers(@Me IMessageIO channel, @Me GuildDB db

@Command(desc = "Get a sheet of transfers")
@RolePermission(value = Roles.ECON, root = true)
public String getIngameTransactions(@Me IMessageIO channel, @Me GuildDB db, @Default NationOrAlliance sender, @Default NationOrAlliance receiver, @Default NationOrAlliance banker, @Default("%epoch%") @Timestamp long timeframe, @Switch("s") SpreadSheet sheet) throws GeneralSecurityException, IOException {
public String getIngameTransactions(@Me IMessageIO channel, @Me GuildDB db,
@AllowDeleted @Default NationOrAlliance sender,
@AllowDeleted @Default NationOrAlliance receiver,
@AllowDeleted @Default NationOrAlliance banker,
@Default("%epoch%") @Timestamp long timeframe, @Switch("s") SpreadSheet sheet) throws GeneralSecurityException, IOException {
if (sheet == null) sheet = SpreadSheet.create(db, SheetKey.BANK_TRANSACTION_SHEET);
List<Transaction2> transactions = Locutus.imp().getBankDB().getAllTransactions(sender, receiver, banker, timeframe, null);
if (transactions.size() > 10000) return "Timeframe is too large, please use a shorter period";
Expand All @@ -2841,7 +2845,7 @@ public String getIngameTransactions(@Me IMessageIO channel, @Me GuildDB db, @Def
})
@RolePermission(value = Roles.ECON)
public String transactions(@Me IMessageIO channel, @Me GuildDB db, @Me User user,
NationOrAllianceOrGuildOrTaxid nationOrAllianceOrGuild,
@AllowDeleted NationOrAllianceOrGuildOrTaxid nationOrAllianceOrGuild,
@Arg(value = "Only show transactions after this time", group = 0)
@Default("%epoch%") @Timestamp long timeframe,
@Arg(value = "Do NOT include the tax record resources below the internal tax rate\n" +
Expand Down

0 comments on commit 82f4c60

Please sign in to comment.