File tree Expand file tree Collapse file tree
nunjucks/views/error-handling Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4545{% endblock %}
4646
4747
48+ {% block footer %}
49+ {{ govukFooter ({}) }}
50+ {% endblock %}
51+
52+
4853{% block pageScripts %}
4954<script >
5055 ;(() => {
Original file line number Diff line number Diff line change @@ -130,8 +130,7 @@ exports.SessionGetColumnsNeedingFormats = (sid) => {
130130
131131 let columnsNeedingFormats = new Array ( ) ;
132132
133- Object . entries ( mappings ) . forEach ( ( entry ) => {
134- const [ colIdx , columnAttribute ] = entry ;
133+ Object . entries ( mappings ) . forEach ( ( colIdx , columnAttribute ) => {
135134 if ( columnAttribute != "" ) {
136135 const columnDef = attributes . find ( ( attr ) => attr . name == columnAttribute ) ;
137136 const columnTypeName = columnDef . type ;
Original file line number Diff line number Diff line change @@ -77,11 +77,17 @@ exports.ListPossibleTypes = (field) => {
7777 // Either way, we can't narrow the set of possible types, but it's a blank cell
7878 return [ false , true ] ;
7979 case "d" : // Date or time or both
80- if ( isDateFormat ( field . z ) ) {
81- possibleTypes . set ( "date" , [ "native" ] ) ;
80+ if ( field . z ) {
81+ if ( isDateFormat ( field . z ) ) {
82+ possibleTypes . set ( "date" , [ "native" ] ) ;
83+ }
84+ // FIXME: Add cases for time formats, eg "h:mm", when we support them
85+ return [ possibleTypes , isBlank ] ;
86+ } else {
87+ // Field format code in field.z should always be present, but let's fail
88+ // quietly if not rather than ruining the whole import
89+ return [ possibleTypes , isBlank ] ;
8290 }
83- // FIXME: Add cases for time formats, eg "h:mm", when we support them
84- return [ possibleTypes , isBlank ] ;
8591 break ;
8692 case "s" :
8793 // String
Original file line number Diff line number Diff line change @@ -98,8 +98,7 @@ const importerPossibleColumnFormats = (data) => {
9898 const dataRange = backend_lib . SessionSuggestDataRange ( session . backendSid , hRange , fRange ) ;
9999 const typeGuesses = backend_lib . SessionGuessTypes ( session . backendSid , dataRange ) ;
100100
101- return Object . entries ( mappings ) . map ( ( entry ) => {
102- const [ colIndex , columnField ] = entry ;
101+ return Object . entries ( mappings ) . map ( ( colIndex , columnField ) => {
103102 if ( ! columnField ) return false ; // Skip unmapped columns
104103 const columnGuesses = typeGuesses [ colIndex ] ;
105104 const columnDef = session . fields . find ( ( field ) => field . name == columnField ) ;
@@ -109,9 +108,7 @@ const importerPossibleColumnFormats = (data) => {
109108 if ( columnGuesses . types && columnGuesses . types . has ( columnTypeName ) ) {
110109 const guessedFormats = columnGuesses . types . get ( columnTypeName ) ;
111110 if ( guessedFormats && columnType . formats ) {
112- likelyFormats = new Set ( Array . from ( columnType . formats . keys ( ) ) . filter ( ( fmtName ) => {
113- return guessedFormats . includes ( fmtName ) ;
114- } ) ) ;
111+ likelyFormats = new Set ( Array . from ( columnType . formats . keys ( ) ) . filter ( ( fmtName ) => guessedFormats . includes ( fmtName ) ) ) ;
115112 }
116113 }
117114
You can’t perform that action at this time.
0 commit comments