diff --git a/Gameye-Tests/GameyeCollectionFactoryTest.class.st b/Gameye-Tests/GameyeCollectionFactoryTest.class.st index 0efa851..b9f3764 100644 --- a/Gameye-Tests/GameyeCollectionFactoryTest.class.st +++ b/Gameye-Tests/GameyeCollectionFactoryTest.class.st @@ -5,7 +5,8 @@ Class { #name : #GameyeCollectionFactoryTest, #superclass : #TestCase, #instVars : [ - 'datas' + 'datas', + 'gameyeVersion' ], #category : #'Gameye-Tests-Core' } @@ -33,16 +34,10 @@ GameyeCollectionFactoryTest class >> exportedSpreadsheetSampleFilename [ ^'2_20_2023_ge_collection' ] -{ #category : #assertions } -GameyeCollectionFactoryTest >> assertCollection: aCollection equalsGameyeVersion: aGameyeVersion [ - - self assert: aCollection gameyeVersion equals: aGameyeVersion -] - { #category : #assertions } GameyeCollectionFactoryTest >> assertCollectionGameyeVersion: aCollection [ - self subclassResponsibility + self assertCollection: aCollection gameyeVersion equals: gameyeVersion ] { #category : #assertions } @@ -70,6 +65,59 @@ GameyeCollectionFactoryTest >> assertWishAndForSellCollectionsAreEmpty: collecti self assert: forSellCollection numberOfCollectibles equals: 0 ] +{ #category : #'tests - common' } +GameyeCollectionFactoryTest >> createCollectionFromExportedSpreadsheet_1System [ + | collection collectible | + + collection := datas at: GameyeCollection owned. + self assert: collection date equals: (Date newDay: 20 month: 2 year: 2023). + self assert: collection haveUnknowns equals: false. + self assert: collection haveVideoGames equals: false. + self assert: collection haveSystems equals: true. + self assert: collection havePeripherals equals: false. + self assert: collection haveToyToLife equals: false. + self assert: collection havePrintMedias equals: false. + self assert: collection numberOfCollectibles equals: 1. + + collectible := collection systemsCollectibles first. + self assert: collectible isSystem. + self assert: collectible isOwned. + self assert: collectible dateAdded equals: (Date newDay: 18 month: 7 year: 2022). + self assert: collectible isBoxed. + self assert: collectible priceLoose equals: 88.91. + self assert: collectible priceCIB equals: 169.46. + self assert: collectible priceNew equals: 381.99. + self assert: collectible yourPrice equals: 156.75. + self assert: collectible pricePaid equals: 139.92. + self assert: collectible itemCondition equals: 10. + self assert: collectible boxCondition isNil. + self assert: collectible manualCondition equals: 10. + self assert: collectible notes isNil. + + self assertWishAndForSellCollectionsAreEmpty: datas +] + +{ #category : #'tests - common' } +GameyeCollectionFactoryTest >> createCollectionFromExportedSpreadsheet_1ToyToLife [ + | collection collectible | + + collection := datas at: GameyeCollection owned. + self assert: collection date equals: (Date newDay: 20 month: 2 year: 2023). + self assert: collection haveUnknowns equals: false. + self assert: collection haveVideoGames equals: false. + self assert: collection haveSystems equals: false. + self assert: collection havePeripherals equals: false. + self assert: collection haveToyToLife equals: true. + self assert: collection havePrintMedias equals: false. + self assert: collection numberOfCollectibles equals: 1. + + collectible := collection toysToLifeCollectibles first. + self assert: collectible dateAdded equals: (Date newDay: 19 month: 4 year: 2022). + self assert: collectible isToyToLife. + + self assertWishAndForSellCollectionsAreEmpty: datas +] + { #category : #running } GameyeCollectionFactoryTest >> setUp [ diff --git a/Gameye-Tests/GameyeCollectionFactoryV4Test.class.st b/Gameye-Tests/GameyeCollectionFactoryV4Test.class.st index ac464c6..5249aae 100644 --- a/Gameye-Tests/GameyeCollectionFactoryV4Test.class.st +++ b/Gameye-Tests/GameyeCollectionFactoryV4Test.class.st @@ -4,21 +4,21 @@ Class { #category : #'Gameye-Tests-Core' } -{ #category : #'samples - v4' } +{ #category : #samples } GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_1Peripheral [ ^self exportedSpreadsheetSampleHeadContentV4, ' "N64","Peripherals",1,0,0,"Expansion Pak","Missing Field","Missing Field","10/07/2021","CIB","46.63","77.35","112.19","77.35","51.85","10","10","10"," "," ",""' ] -{ #category : #'samples - v4' } +{ #category : #samples } GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_1PeripheralAsAUnknownCollectible [ ^self exportedSpreadsheetSampleHeadContentV4, ' "SNES","?",1,0,0,"Super Scope 6 [Gun Bundle]","Missing Field","Missing Field","13/09/2021","Boxed","-1.0", "-1.0", "-1.0", "-1.0","55.97","10","?","9"," "," ","This is a commentary"' ] -{ #category : #'samples - v4' } +{ #category : #samples } GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_1PrintMedia [ "1 Print media sample" @@ -26,7 +26,7 @@ GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_1Print "N Power","Print Media",1,0,0,"[Vol. 145] Mario Advance","Missing Field","Missing Field","11/03/2023","Loose","9.49","14.23","?","9.49","1.90","?","?","10"," "," ",""' ] -{ #category : #'samples - v4' } +{ #category : #samples } GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_1System [ "1 System sample" @@ -34,7 +34,7 @@ GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_1Syste "Saturn","Systems",1,0,0,"Sega Saturn Console (PAL)","Missing Field","Missing Field","18/07/2022","Boxed","88.91","169.46","381.99","156.75","139.92","10","?","10"," "," ",""' ] -{ #category : #'samples - v4' } +{ #category : #samples } GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_1ToyToLife [ "1 System sample" @@ -42,7 +42,7 @@ GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_1ToyTo "amiibo","ToysToLife",1,0,0,"Zelda - Breath of Wild","Missing Field","Missing Field","19/04/2022","Loose","26.11","26.11","36.44","26.11","13.99","?","?","10"," "," ",""' ] -{ #category : #'samples - v4' } +{ #category : #samples } GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_1VideoGameWitComplexeStringValues [ "This game have title and developper names with coma and quotes : ""Ivan ""Ironman"" Stewart's Super Off Road"" and ""Rare, Ltd.""" @@ -50,7 +50,7 @@ GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_1Video "NES","VideoGame",1,0,0,"Ivan "Ironman" Stewart''s Super Off Road","Tradewest, Inc.","Rare, Ltd.","22/03/2021","CIB","10.85","46.64","326.48","46.64","-1.0","6","7","7"," "," ",""' ] -{ #category : #'accessing - v4' } +{ #category : #samples } GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_3VideoGames2SystemsWitComplexeStringValues [ "This is an extract from problematic strings content" @@ -62,7 +62,7 @@ GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_3Video "PS1","VideoGame",1,0,0,"Broken Sword 2 - Les Boucliers de Quetzalcoatl","Sony","Revolution Software Ltd.","22/03/2021","CIB","-1.0", "-1.0", "-1.0", "-1.0","-1.0","10","10","10"," "," ",""' ] -{ #category : #'samples - v4' } +{ #category : #samples } GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_4VideoGamesWitComplexeStringValues [ "This game have title and developper names with coma and quotes : ""Ivan ""Ironman"" Stewart's Super Off Road"" and ""Rare, Ltd.""" @@ -73,14 +73,14 @@ GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_4Video "Atari 2600","VideoGame",1,0,0,"Space Invaders","(null)","(null)","22/03/2021","Loose","-1.0", "-1.0", "-1.0", "-1.0","?","?","?","5"," "," ","Étiquette percée, en pack avec la console"' ] -{ #category : #'samples - v4' } +{ #category : #samples } GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_Empty [ "This sample contains some frequently generated cases not easy to read/parse or exceptions due to collection evolution" ^self exportedSpreadsheetSampleHeadContentV4 ] -{ #category : #'samples - v4' } +{ #category : #samples } GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_Wishlist_1VideoGame [ "This game have title and developper names with coma and quotes : ""Ivan ""Ironman"" Stewart's Super Off Road"" and ""Rare, Ltd.""" @@ -88,14 +88,14 @@ GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_Wishli "Switch","VideoGame",0,0,1,"Advance Wars 1+2: Re-Boot Camp","Nintendo","WayForward Technologies","","Wishlist","-1.0", "-1.0", "-1.0", "-1.0","-1.0"," "," "," "," "," ",""' ] -{ #category : #'accessing - v4' } +{ #category : #accessing } GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleFileReferenceV4_Empty [ ^self exportedSpreadsheetSampleFileReference: self exportedSpreadsheetSampleContentV4_Empty ] -{ #category : #'accessing - v4' } +{ #category : #accessing } GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleHeadContentV4 [ "This sample contains columns head" @@ -103,9 +103,10 @@ GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleHeadContentV4 [ ] { #category : #assertions } -GameyeCollectionFactoryV4Test >> assertCollectionGameyeVersion: aCollection [ +GameyeCollectionFactoryV4Test >> setUp [ - self assertCollection: aCollection equalsGameyeVersion: GameyeVersion v4 + super setUp. + gameyeVersion := GameyeVersion v4. ] { #category : #'tests - v4' } @@ -185,49 +186,28 @@ GameyeCollectionFactoryV4Test >> testCreateCollectionFromExportedSpreadsheet_1Pr { #category : #'tests - v4' } GameyeCollectionFactoryV4Test >> testCreateCollectionFromExportedSpreadsheet_1System [ - | collection collectible collections | - collections := GameyeCollectionFactory createCollectionsFromExportedSpreadsheet: (self class + | collectible collection | + datas := GameyeCollectionFactory createCollectionsFromExportedSpreadsheet: (self class exportedSpreadsheetSampleFileReference: self class exportedSpreadsheetSampleContentV4_1System). - collection := collections at: GameyeCollection owned. - self assert: collection date equals: (Date newDay: 20 month: 2 year: 2023). - self assert: collection haveUnknowns equals: false. - self assert: collection haveVideoGames equals: false. - self assert: collection haveSystems equals: true. - self assert: collection havePeripherals equals: false. - self assert: collection haveToyToLife equals: false. - self assert: collection havePrintMedias equals: false. - self assert: collection numberOfCollectibles equals: 1. - + self createCollectionFromExportedSpreadsheet_1System. + + collection := datas at: GameyeCollection owned. collectible := collection systemsCollectibles first. - self assert: collectible dateAdded equals: (Date newDay: 18 month: 7 year: 2022). - self assert: collectible isSystem. - - self assertWishAndForSellCollectionsAreEmpty: collections + self assert: collectible platform equals: 'Saturn'. + self assert: collectible title equals: 'Sega Saturn Console (PAL)'. + self assert: collectible country isNil. + self assert: collectible releaseType isNil. + self assert: collectible tags isNil. ] { #category : #'tests - v4' } GameyeCollectionFactoryV4Test >> testCreateCollectionFromExportedSpreadsheet_1ToyToLife [ - | collection collectible collections | - collections := GameyeCollectionFactory createCollectionsFromExportedSpreadsheet: (self class + datas := GameyeCollectionFactory createCollectionsFromExportedSpreadsheet: (self class exportedSpreadsheetSampleFileReference: self class exportedSpreadsheetSampleContentV4_1ToyToLife). - collection := collections at: GameyeCollection owned. - self assert: collection date equals: (Date newDay: 20 month: 2 year: 2023). - self assert: collection haveUnknowns equals: false. - self assert: collection haveVideoGames equals: false. - self assert: collection haveSystems equals: false. - self assert: collection havePeripherals equals: false. - self assert: collection haveToyToLife equals: true. - self assert: collection havePrintMedias equals: false. - self assert: collection numberOfCollectibles equals: 1. - - collectible := collection toysToLifeCollectibles first. - self assert: collectible dateAdded equals: (Date newDay: 19 month: 4 year: 2022). - self assert: collectible isToyToLife. - - self assertWishAndForSellCollectionsAreEmpty: collections + self createCollectionFromExportedSpreadsheet_1ToyToLife. ] { #category : #'tests - v4' } diff --git a/Gameye-Tests/GameyeCollectionFactoryV5Test.class.st b/Gameye-Tests/GameyeCollectionFactoryV5Test.class.st new file mode 100644 index 0000000..ff736e6 --- /dev/null +++ b/Gameye-Tests/GameyeCollectionFactoryV5Test.class.st @@ -0,0 +1,75 @@ +Class { + #name : #GameyeCollectionFactoryV5Test, + #superclass : #GameyeCollectionFactoryTest, + #category : #'Gameye-Tests-Core' +} + +{ #category : #samples } +GameyeCollectionFactoryV5Test class >> exportedSpreadsheetSampleContentV5_1System [ + "self exportedSpreadsheetSampleContentV5_1System" + + ^self exportedSpreadsheetSampleHeadContentV5, ' +"Sega Saturn","Systems","Owned","Sega Saturn Console","United Kingdom","Official","Missing Field","Missing Field","18/07/2022","Boxed","88.91","169.46","381.99","156.75","139.92","10","?","10"," "," ","","✔️ 📦",' +] + +{ #category : #samples } +GameyeCollectionFactoryV5Test class >> exportedSpreadsheetSampleContentV5_1ToyToLife [ + + ^self exportedSpreadsheetSampleHeadContentV5, ' +"amiibo","Toys To Life","Owned","Zelda - Breath of Wild","","Official","Nintendo","Missing Field","19/04/2022","Loose","24.40","?","29.41","24.40","15.00","10","?","?"," "," ","","",' +] + +{ #category : #samples } +GameyeCollectionFactoryV5Test class >> exportedSpreadsheetSampleContentV5_Empty [ + "This sample contains some frequently generated cases not easy to read/parse or exceptions due to collection evolution" + + ^self exportedSpreadsheetSampleHeadContentV5 +] + +{ #category : #accessing } +GameyeCollectionFactoryV5Test class >> exportedSpreadsheetSampleFileReferenceV5_Empty [ + + + ^self exportedSpreadsheetSampleFileReference: self exportedSpreadsheetSampleContentV5_Empty +] + +{ #category : #accessing } +GameyeCollectionFactoryV5Test class >> exportedSpreadsheetSampleHeadContentV5 [ + "This sample contains columns head" + + ^'Platform,Category,UserRecordType,Title,Country,ReleaseType,Publisher,Developer,CreatedAt,Ownership,PriceLoose,PriceCIB,PriceNew,YourPrice,PricePaid,ItemCondition,BoxCondition,ManualCondition,Beat,PlayedCompletion,Notes,Tags' +] + +{ #category : #running } +GameyeCollectionFactoryV5Test >> setUp [ + + super setUp. + gameyeVersion := GameyeVersion v5. +] + +{ #category : #running } +GameyeCollectionFactoryV5Test >> testCreateCollectionFromExportedSpreadsheet_1System [ + + | collection collectible | + datas := GameyeCollectionFactory createCollectionsFromExportedSpreadsheet: (self class + exportedSpreadsheetSampleFileReference: self class exportedSpreadsheetSampleContentV5_1System). + + self createCollectionFromExportedSpreadsheet_1System. + + collection := datas at: GameyeCollection owned. + collectible := collection systemsCollectibles first. + self assert: collectible platform equals: 'Sega Saturn'. + self assert: collectible title equals: 'Sega Saturn Console'. + self assert: collectible country equals: #'United Kingdom'. + self assert: collectible releaseType equals: #'Official'. + self assert: collectible tags notNil. +] + +{ #category : #running } +GameyeCollectionFactoryV5Test >> testCreateCollectionFromExportedSpreadsheet_1ToyToLife [ + + datas := GameyeCollectionFactory createCollectionsFromExportedSpreadsheet: (self class + exportedSpreadsheetSampleFileReference: self class exportedSpreadsheetSampleContentV5_1ToyToLife). + + self createCollectionFromExportedSpreadsheet_1ToyToLife. +] diff --git a/Gameye/AbstractGameyeInputDataUtils.class.st b/Gameye/AbstractGameyeInputDataUtils.class.st index b49430a..4e5facd 100644 --- a/Gameye/AbstractGameyeInputDataUtils.class.st +++ b/Gameye/AbstractGameyeInputDataUtils.class.st @@ -7,7 +7,7 @@ Class { { #category : #parsing } AbstractGameyeInputDataUtils class >> createCollectibleFromDataArray: anArray [ - self subclassResponsibility + self subclassResponsibility ] { #category : #parsing } diff --git a/Gameye/GameyeAccessory.class.st b/Gameye/GameyeAccessory.class.st new file mode 100644 index 0000000..c76ba01 --- /dev/null +++ b/Gameye/GameyeAccessory.class.st @@ -0,0 +1,17 @@ +Class { + #name : #GameyeAccessory, + #superclass : #GameyePeripheral, + #category : #'Gameye-Model' +} + +{ #category : #accessing } +GameyeAccessory class >> type [ + + ^ #'Game Accessories' +] + +{ #category : #testing } +GameyeAccessory >> isAccessory [ + + ^ true +] diff --git a/Gameye/GameyeCollectible.class.st b/Gameye/GameyeCollectible.class.st index 71cbb3f..75e3fa5 100644 --- a/Gameye/GameyeCollectible.class.st +++ b/Gameye/GameyeCollectible.class.st @@ -8,6 +8,8 @@ Class { 'isForSale', 'isOnWishList', 'title', + 'country', + 'releaseType', 'dateAdded', 'ownership', 'priceLoose', @@ -19,6 +21,7 @@ Class { 'boxCondition', 'manualCondition', 'notes', + 'tags', 'rawDatas' ], #category : #'Gameye-Model' @@ -62,6 +65,18 @@ GameyeCollectible >> boxCondition: anObject [ boxCondition := anObject ] +{ #category : #accessing } +GameyeCollectible >> country [ + + ^ country +] + +{ #category : #accessing } +GameyeCollectible >> country: anObject [ + + country := anObject +] + { #category : #accessing } GameyeCollectible >> dateAdded [ @@ -391,6 +406,30 @@ GameyeCollectible >> rawDatas: anObject [ rawDatas := anObject ] +{ #category : #accessing } +GameyeCollectible >> releaseType [ + + ^ releaseType +] + +{ #category : #accessing } +GameyeCollectible >> releaseType: anObject [ + + releaseType := anObject +] + +{ #category : #accessing } +GameyeCollectible >> tags [ + + ^ tags +] + +{ #category : #accessing } +GameyeCollectible >> tags: anObject [ + + tags := anObject +] + { #category : #accessing } GameyeCollectible >> title [ diff --git a/Gameye/GameyeController.class.st b/Gameye/GameyeController.class.st new file mode 100644 index 0000000..404a868 --- /dev/null +++ b/Gameye/GameyeController.class.st @@ -0,0 +1,17 @@ +Class { + #name : #GameyeController, + #superclass : #GameyePeripheral, + #category : #'Gameye-Model' +} + +{ #category : #accessing } +GameyeController class >> type [ + + ^ #Controllers +] + +{ #category : #testing } +GameyeController >> isController [ + + ^ true +] diff --git a/Gameye/GameyePeripheral.class.st b/Gameye/GameyePeripheral.class.st index b73820c..b7b60d8 100644 --- a/Gameye/GameyePeripheral.class.st +++ b/Gameye/GameyePeripheral.class.st @@ -10,6 +10,18 @@ GameyePeripheral class >> type [ ^ #Peripherals ] +{ #category : #testing } +GameyePeripheral >> isAccessory [ + + ^ false +] + +{ #category : #testing } +GameyePeripheral >> isController [ + + ^ false +] + { #category : #testing } GameyePeripheral >> isPeripheral [ diff --git a/Gameye/GameyeV5InputDataUtils.class.st b/Gameye/GameyeV5InputDataUtils.class.st index 03b1e24..47bc574 100644 --- a/Gameye/GameyeV5InputDataUtils.class.st +++ b/Gameye/GameyeV5InputDataUtils.class.st @@ -4,18 +4,150 @@ Class { #category : #'Gameye-Core' } +{ #category : #parsing } +GameyeV5InputDataUtils class >> createCollectibleFromDataArray: anArray [ + | collectible userRecordType | + + anArray ifNil: [ ^ nil ]. + anArray size = self numberOfExportedSpreadsheetColumns ifFalse:[ ^ nil ]. + + "Create the collectible" + collectible := GameyeCollectible type: (anArray at: 2). + collectible platform: (anArray at: 1). + userRecordType := anArray at: 3. + collectible isOwned: (userRecordType = #Owned). + collectible isForSale: (userRecordType = #ForSale). + collectible isOnWishList: (userRecordType = #Wishlist). self flag:'labordep: check if this is the correct symbol'. + collectible title: (anArray at: 4). + collectible country: (anArray at: 5). + collectible releaseType: (anArray at: 6). + collectible dateAdded: (anArray at: 9). + collectible ownership: (anArray at: 10). + collectible priceLoose: (anArray at: 11). + collectible priceCIB: (anArray at: 12). + collectible priceNew: (anArray at: 13). + collectible yourPrice: (anArray at: 14). + collectible pricePaid: (anArray at: 15). + collectible itemCondition: (anArray at: 16). + collectible boxCondition: (anArray at: 17). + collectible manualCondition: (anArray at: 18). + collectible notes: (anArray at: 21). + collectible tags: (anArray at: 22). + + "Processing for Video Games" + collectible isVideoGame ifTrue:[ + collectible publisher: (anArray at: 7). + collectible developer: (anArray at: 8). + collectible isBeat: (anArray at: 19). + collectible playedCompletion: (anArray at: 20). + ]. + + "Processing for unknown collectible : conserve original datas to have a post analyse" + collectible isUnknown ifTrue:[collectible rawDatas: anArray]. + + ^ collectible +] + { #category : #accessing } GameyeV5InputDataUtils class >> gameyeVersion [ ^ GameyeVersion v5 ] +{ #category : #parsing } +GameyeV5InputDataUtils class >> getSpreadsheetReadStream: aFileReference [ + "Return a ReadStream of an exported SpreadSheet file with fixing all knowns generation knowns problems" + | readStream line fixedStream | + + readStream := aFileReference readStream. + line := readStream nextLine. + + "Build the new stream" + fixedStream := ReadWriteStream on: String new. + fixedStream nextPutAll: line; cr. + + line := readStream nextLine. + + [ line notNil ] whileTrue:[ | cells columnId | + cells := self extractCellsFromLine: line. + columnId := 1. + "Cell content processing" + cells do:[ :cell | | formattedCell | + + "Print media type as a symbol without space" + (columnId = 2 and:[cell = self exportedSpreadsheetPrintMediaType]) ifTrue:[ + formattedCell := '"PrintMedia"'. + self flag:'labordep: check if printed media call have same name in v4 and v5'. + ] ifFalse:[ + "Remove not necessary spaces at the start or the end" + formattedCell := cell withBlanksCondensed withoutQuoting. + formattedCell := formattedCell copyReplaceAll: '"' with: '""'. + ]. + + fixedStream nextPutAll: formattedCell. + + ] separatedBy:[ + fixedStream nextPut: $,. + columnId := columnId + 1 + ]. + + fixedStream cr. + + line := readStream nextLine. + ]. + + readStream close. + ^ fixedStream reset +] + { #category : #accessing } GameyeV5InputDataUtils class >> numberOfExportedSpreadsheetColumns [ ^ 22 ] +{ #category : #parsing } +GameyeV5InputDataUtils class >> parseExportedSpreadsheetReadStream: aReadStream [ + "Parse a CSV readstream as an array" + | neoCSVReader array | + neoCSVReader := NeoCSVReader on: aReadStream. + + array := neoCSVReader + separator: $,; + skipHeader; + addField; "Platform" + addFieldConverter: [ :string | + string = 'Games' ifTrue:[GameyeVideoGame type] ifFalse:[ + string = 'Toys To Life' ifTrue:[GameyeToyToLife type] ifFalse:[ + string + ]. + ]. + ]; "Category" + addSymbolField; "UserRecordType" + addFieldConverter: [ :string | string = 'Missing Field' ifTrue:[nil] ifFalse:[string] ]; "Title" + addSymbolField; "Country" + addSymbolField; "Release type" + addFieldConverter: [ :string | string = 'Missing Field' ifTrue:[nil] ifFalse:[string] ]; "Publisher" + addFieldConverter: [ :string | string = 'Missing Field' ifTrue:[nil] ifFalse:[string] ]; "Developer" + addFieldConverter: [ :string | Date readFrom: string pattern: 'dd/mm/yyyy' ]; "CreatedAt" + addSymbolField; "Ownership" + addFieldConverter: [ :string | self parseNeoNumberString: string ]; "PriceLoose" + addFieldConverter: [ :string | self parseNeoNumberString: string ]; "PriceCIB" + addFieldConverter: [ :string | self parseNeoNumberString: string ]; "PriceNew" + addFieldConverter: [ :string | self parseNeoNumberString: string ]; "YourPrice" + addFieldConverter: [ :string | self parseNeoNumberString: string ]; "PricePaid" + addFieldConverter: [ :string | NeoNumberParser parse: string ifFail: [nil] ]; "ItemCondition" + addFieldConverter: [ :string | NeoNumberParser parse: string ifFail: [nil] ]; "BoxCondition" + addFieldConverter: [ :string | NeoNumberParser parse: string ifFail: [nil] ]; "ManualCondition" + addField; "Beat" + addField; "PlayedCompletion" + addField; "Notes" + addField; "Tags" + upToEnd. + + ^array +] + { #category : #'see class side' } GameyeV5InputDataUtils >> seeClassSide [ ]