@@ -46,6 +46,7 @@ type UpdateLogPostSubmission = {
46
46
type RelevantErasUpdateLogPost = {
47
47
currentSubmission : UpdateLogPostSubmission ;
48
48
ranksToShow : number | null ;
49
+ isFastestCompletion : boolean ;
49
50
relevantChannelIds : Set < string > ;
50
51
ranking : number | null ;
51
52
isWR :
@@ -1022,12 +1023,6 @@ export class SubmissionService extends PaginatedService {
1022
1023
fieldPath
1023
1024
) ;
1024
1025
1025
- const eventStr = generateEventText (
1026
- submission [ "event.name" ] ,
1027
- submission . participants ,
1028
- submission [ "event.maxParticipants" ]
1029
- ) ;
1030
-
1031
1026
const submissionLinks =
1032
1027
await SubmissionCharacterParticipantLink . getAllSqlRecord ( {
1033
1028
select : [ "character.name" , "character.id" ] ,
@@ -1048,6 +1043,7 @@ export class SubmissionService extends PaginatedService {
1048
1043
characters : submissionLinks . map ( ( link ) => link [ "character.name" ] ) ,
1049
1044
} ,
1050
1045
ranksToShow : null ,
1046
+ isFastestCompletion : false ,
1051
1047
relevantChannelIds : new Set ( ) ,
1052
1048
ranking : relevantEraRanking ,
1053
1049
isWR : relevantEraRanking === 1 ? { isTie : false } : false ,
@@ -1218,7 +1214,7 @@ export class SubmissionService extends PaginatedService {
1218
1214
// check if this record would appear in any normal style leaderboards. eventEraMode: relevant_eras only
1219
1215
if ( relevantErasUpdateLogPost . ranking ) {
1220
1216
const discordChannelOutputs = await DiscordChannelOutput . getAllSqlRecord ( {
1221
- select : [ "ranksToShow" , "discordChannel.channelId" ] ,
1217
+ select : [ "ranksToShow" , "discordChannel.channelId" , "participants" ] ,
1222
1218
where : [
1223
1219
{
1224
1220
field : "event.id" ,
@@ -1256,6 +1252,14 @@ export class SubmissionService extends PaginatedService {
1256
1252
...discordChannelOutputs . map ( ( ele ) => ele . ranksToShow )
1257
1253
) ;
1258
1254
1255
+ // if one output and it is for fastest completion, need to adjust the flag
1256
+ if (
1257
+ discordChannelOutputs . length === 1 &&
1258
+ discordChannelOutputs [ 0 ] . participants === null
1259
+ ) {
1260
+ relevantErasUpdateLogPost . isFastestCompletion = true ;
1261
+ }
1262
+
1259
1263
relevantErasUpdateLogPost . relevantChannelIds = new Set (
1260
1264
discordChannelOutputs . map (
1261
1265
( output ) => output [ "discordChannel.channelId" ]
@@ -1341,6 +1345,11 @@ export class SubmissionService extends PaginatedService {
1341
1345
// generate the discord message for soloPBUpdateLogPost
1342
1346
// case 1: improvement from X -> Y place
1343
1347
if ( soloPBUpdateLogPost . relevantChannelIds . size ) {
1348
+ const eventStr = generateEventText (
1349
+ submission [ "event.name" ] ,
1350
+ submission . participants ,
1351
+ submission [ "event.maxParticipants" ]
1352
+ ) ;
1344
1353
if ( soloPBUpdateLogPost . currentUserSecondPlaceSubmission ) {
1345
1354
discordMessageContents . push ( {
1346
1355
content : `<t:${ Math . floor ( submission . happenedOn ) } :D>\n\n${
@@ -1420,6 +1429,14 @@ export class SubmissionService extends PaginatedService {
1420
1429
relevantErasUpdateLogPost . relevantChannelIds . size &&
1421
1430
discordMessageContents . length < 1
1422
1431
) {
1432
+ const eventStr = generateEventText (
1433
+ submission [ "event.name" ] ,
1434
+ relevantErasUpdateLogPost . isFastestCompletion
1435
+ ? null
1436
+ : submission . participants ,
1437
+ submission [ "event.maxParticipants" ]
1438
+ ) ;
1439
+
1423
1440
if (
1424
1441
relevantErasUpdateLogPost . isWR &&
1425
1442
! relevantErasUpdateLogPost . isWR . isTie &&
0 commit comments