Skip to content

Commit

Permalink
Fixed conversion from String to Int
Browse files Browse the repository at this point in the history
The issue was that the string value extracted from the CSV is `"73"` INCLUDING the quotation marks and not `73`, and the conversion to Int failed because of them. Removing the quotes fixes the issue.
  • Loading branch information
fredericsimard committed Feb 21, 2024
1 parent 24094ef commit fda9a6e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/process_csv_in_github_action.swift
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ if CommandLine.argc == 5 {
let realtimefeatures : String = line[column.realtimefeatures.rawValue]
let redirects : String = line[column.gtfsredirect.rawValue]
let feed_contact_email : String = line[column.dataproduceremail2.rawValue]
let old_mbd_ID : Int = Int(line[column.oldMobilityDatabaseID.rawValue]) ?? 0
let old_mbd_ID_String : String = line[column.oldMobilityDatabaseID.rawValue].trimmingCharacters(in: CharacterSet(charactersIn: "\"")) // We need to remove the trailing quotation marks from the value, they interfere with the conversion to Int.
let old_mbd_ID : Int = Int(old_mbd_ID_String) ?? 0

if isInDebugMode { print("datatype : \(datatype)") }
if isInDebugMode { print("request : \(request)") }
Expand Down

0 comments on commit fda9a6e

Please sign in to comment.