Skip to content

Commit 15cfc51

Browse files
authored
Merge pull request #903 from bcgov/fix/DSS-1146
DSS-1146
2 parents 612cb6e + a7f2b33 commit 15cfc51

File tree

4 files changed

+31
-16
lines changed

4 files changed

+31
-16
lines changed

database/ddl/STR_DSS_Incremental_DB_DDL_Sprint_21.sql

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@ COMMENT ON COLUMN dss_physical_address.reg_rental_unit_no IS 'The rental propert
77
COMMENT ON COLUMN dss_physical_address.reg_rental_street_no IS 'The rental property street number used to validate the bc registry number ';
88
COMMENT ON COLUMN dss_physical_address.reg_rental_postal_code IS 'The rental property postal code number used to validate the bc registry number ';
99

10+
11+
1012
-- Create new columns for holding upload status information for delivery files
1113
ALTER TABLE dss_upload_delivery ADD upload_status varchar(20);
12-
ALTER TABLE dss_upload_delivery ADD upload_lines_total smallint;
13-
ALTER TABLE dss_upload_delivery ADD upload_lines_success smallint;
14-
ALTER TABLE dss_upload_delivery ADD upload_lines_error smallint;
15-
ALTER TABLE dss_upload_delivery ADD upload_lines_processed smallint;
14+
ALTER TABLE dss_upload_delivery ADD upload_lines_total int;
15+
ALTER TABLE dss_upload_delivery ADD upload_lines_success int;
16+
ALTER TABLE dss_upload_delivery ADD upload_lines_error int;
17+
ALTER TABLE dss_upload_delivery ADD upload_lines_processed int;
1618
ALTER TABLE dss_upload_delivery ADD registration_status varchar(20);
17-
ALTER TABLE dss_upload_delivery ADD registration_lines_failure smallint;
18-
ALTER TABLE dss_upload_delivery ADD registration_lines_success smallint;
19+
ALTER TABLE dss_upload_delivery ADD registration_lines_failure int;
20+
ALTER TABLE dss_upload_delivery ADD registration_lines_success int;
1921
ALTER TABLE dss_upload_delivery ADD upload_user_guid uuid;
2022
ALTER TABLE dss_upload_delivery ADD upload_date timestamptz;
2123

database/ddl/STR_DSS_Physical_DB_DDL_Sprint_21.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,13 @@ CREATE TABLE dss_upload_delivery (
186186
source_header_txt varchar(32000) ,
187187
providing_organization_id bigint NOT NULL ,
188188
upload_status varchar(20) NOT NULL,
189-
upload_lines_total smallint NOT NULL,
190-
upload_lines_success smallint,
191-
upload_lines_error smallint,
192-
upload_lines_processed smallint,
189+
upload_lines_total int NOT NULL,
190+
upload_lines_success int,
191+
upload_lines_error int,
192+
upload_lines_processed int,
193193
registration_status varchar(20),
194-
registration_lines_failure smallint,
195-
registration_lines_success smallint,
194+
registration_lines_failure int,
195+
registration_lines_success int,
196196
upload_user_guid uuid,
197197
upd_dtm timestamptz NOT NULL ,
198198
upd_user_guid uuid ,

server/StrDss.Common/Constants.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,8 @@ public static class RegistrationValidationText
646646
{
647647
public const string Success = "Success";
648648
public const string DataInvalid = "To validate the registration, please provide the registration number or the rental address associated with this listing.";
649-
public const string STRAAExempt = "FN reserve land. This address is exempt from the STRAA.";
650-
public const string NotSTRAAExempt = "Please verify if this STR offer is not required to be registered.";
649+
public const string STRAAExempt = "Registration not required.";
650+
public const string NotSTRAAExempt = "Registration required for this address unless they qualify for exemption.";
651651
public const string AddressNotFound = "Address not found.";
652652
public const string JurisdictionNotFound = "Jurisdiction not found.";
653653
public const string ExemptionStatusNotFound = "Exemption status not found.";

server/StrDss.Service/UploadDeliveryService.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ public async Task<PagedDto<UploadHistoryViewDto>> GetUploadHistory(long? orgId,
589589
var contents = new StringBuilder();
590590

591591
csv.Read();
592-
var header = "code,validation_result," + csv.Parser.RawRecord.TrimEndNewLine();
592+
var header = "validation_result,code,details" + csv.Parser.RawRecord.TrimEndNewLine();
593593

594594
contents.AppendLine(header);
595595

@@ -600,19 +600,32 @@ public async Task<PagedDto<UploadHistoryViewDto>> GetUploadHistory(long? orgId,
600600

601601
string? code = null;
602602
string? message = null;
603+
string result = "Fail";
603604

604605
if (text.Contains(":"))
605606
{
606607
var parts = text.Split(':', 2);
607608
code = parts[0].Trim();
608609
message = parts.Length > 1 ? parts[1].Trim() : null;
610+
611+
// Check for API Failure?
612+
if (string.Compare(code, "500") == 0)
613+
{
614+
result = "API Failure";
615+
message = "";
616+
}
617+
618+
// We are only a pass if the message is "Active"
619+
if (string.Compare(message, "Active", StringComparison.OrdinalIgnoreCase) == 0) result = "Pass";
609620
}
610621
else
611622
{
623+
// This is the case where there was no API call, but we checked to see if they were STRAA exempt
612624
message = text;
625+
result = string.Compare(message, RegistrationValidationText.STRAAExempt, StringComparison.OrdinalIgnoreCase) == 0 ? "Pass" : "Fail";
613626
}
614627

615-
contents.AppendLine($"\"{code}\",\"{message}\"," + line.LineText.TrimEndNewLine());
628+
contents.AppendLine($"\"{result}\",\"{code}\",\"{message}\"," + line.LineText.TrimEndNewLine());
616629
}
617630

618631
return Encoding.UTF8.GetBytes(contents.ToString());

0 commit comments

Comments
 (0)