-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #249 from hpi-swa-teaching/bugfix/csv_export
Bugfix/csv export
- Loading branch information
Showing
23 changed files
with
81 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/Liquid-Core.package/LQPoll.class/class/pathToExport.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
instance creation | ||
pathToExport | ||
^ FileDirectory default fullName , FileDirectory default pathNameDelimiter , 'DataExports' |
20 changes: 14 additions & 6 deletions
20
packages/Liquid-Core.package/LQPoll.class/instance/exportCSV.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
printing | ||
exportCSV | ||
|
||
| stream | | ||
|
||
stream := WriteStream on: String new. | ||
self printDataOn: stream withDelimiter: ';'. | ||
^ stream contents | ||
| filePath directory | | ||
directory := FileDirectory on: self class pathToExport. | ||
directory exists | ||
ifFalse: [FileDirectory default createDirectory: self class pathToExport]. | ||
filePath := self class pathToExport , FileDirectory default pathNameDelimiter , self id , '.csv'. | ||
(FileDirectory default fileExists: filePath) | ||
ifTrue: [| confirmDeletion | | ||
confirmDeletion := UIManager default confirm: 'A poll CSV file with that id already exists. Delete it and recreate it?'. | ||
confirmDeletion | ||
ifFalse: [^ self]. | ||
FileDirectory default deleteFileNamed: filePath]. | ||
FileStream | ||
newFileNamed: filePath | ||
do: [:aStream | self printDataOn: aStream withDelimiter: ';'] |
8 changes: 0 additions & 8 deletions
8
packages/Liquid-Core.package/LQPoll.class/instance/exportCSVDownloadsPath.st
This file was deleted.
Oops, something went wrong.
22 changes: 12 additions & 10 deletions
22
packages/Liquid-Core.package/LQPoll.class/instance/printDataOn.withDelimiter..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
printing | ||
printDataOn: aStream withDelimiter: aDelimiter | ||
|
||
printDataOn: aStream withDelimiter: aDelimiter | ||
| orderedIds | | ||
|
||
orderedIds := self pollDraft questionList collect: [:aQuestion | aQuestion id]. | ||
self pollDraft questionList do: [:aQuestion | | ||
aStream nextPutAll: aQuestion title. | ||
aStream nextPutAll: aDelimiter]. | ||
orderedIds := self pollDraft questionList | ||
collect: [:aQuestion | aQuestion id]. | ||
self pollDraft questionList | ||
do: [:aQuestion | | ||
aStream nextPutAll: aQuestion title. | ||
aStream nextPutAll: aDelimiter]. | ||
aStream nextPut: Character cr. | ||
self answerSets do: [:answer | | ||
answer printDataOn: aStream for: orderedIds with: aDelimiter. | ||
aStream nextPut: Character cr] | ||
self answerSets | ||
do: [:answer | | ||
answer | ||
printDataOn: aStream for: orderedIds with: aDelimiter. | ||
aStream nextPut: Character cr]. |
6 changes: 6 additions & 0 deletions
6
packages/Liquid-Core.package/LQPoll.class/instance/returnDataWithDelimiter..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
printing | ||
returnDataWithDelimiter: aDelimiter | ||
| aStream | | ||
aStream := String new writeStream. | ||
self printDataOn: aStream withDelimiter: $;. | ||
^ aStream contents |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/Liquid-Core.package/LQStringProcessor.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"class" : { | ||
"replaceAll:in:" : "vl 6/1/2024 14:31" }, | ||
"replaceAll:in:" : "vl 5/30/2024 17:23" }, | ||
"instance" : { | ||
} } |
Empty file.
12 changes: 0 additions & 12 deletions
12
packages/Liquid-Tests.package/LQCsvTest.class/instance/testWriteDataLocation.st
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
packages/Liquid-Tests.package/LQCsvTest.class/methodProperties.json
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
packages/Liquid-Tests.package/LQCsvTest.class/properties.json
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
packages/Liquid-Tests.package/LQPollTests.class/instance/testCSVExport.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
testing | ||
testCSVExport | ||
| filePath fileStream buffer match | | ||
self poll addAnswerSet: self as1. | ||
filePath := LQPoll pathToExport , FileDirectory default pathNameDelimiter , self poll id , '.csv'. | ||
FileDirectory default | ||
deleteFileNamed: filePath | ||
ifAbsent: []. | ||
self poll exportCSV. | ||
fileStream := FileStream fileNamed: filePath. | ||
buffer := fileStream contents. | ||
match := 'Question 1;Question 2; | ||
Q1A1:Q1A2;Q1A2; | ||
'. | ||
self assert: match equals: buffer. | ||
fileStream close |
17 changes: 0 additions & 17 deletions
17
packages/Liquid-Tests.package/LQPollTests.class/instance/testCsvPrinting.st
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
packages/Liquid-UI.package/LQHostMenu.class/instance/exportResults.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
modifying | ||
exportResults | ||
| pollNameInput foundPoll | | ||
pollNameInput := UIManager default request: 'Enter Poll ID'. | ||
pollNameInput | ||
ifEmpty: [^ self]. | ||
foundPoll := LQRemotePollRepoServer pollRepo | ||
at: pollNameInput | ||
ifAbsent: [^ UIManager default inform: 'This poll does not exist.']. | ||
foundPoll exportCSV |
10 changes: 0 additions & 10 deletions
10
packages/Liquid-UI.package/LQHostMenu.class/instance/showResults.st
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/Liquid-UI.package/LQResultsView.class/instance/getResults.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
modifying | ||
getResults | ||
|
||
^ self poll exportCSVDownloadsPath | ||
^ self poll exportCSV |
6 changes: 3 additions & 3 deletions
6
packages/Liquid-UI.package/LQResultsView.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
{ | ||
"class" : { | ||
"newWithPoll:" : "CG 7/30/2021 19:06", | ||
"open" : "CG 7/30/2021 19:06" }, | ||
"newWithPoll:" : "5/22/2024 19:59:29", | ||
"open" : "5/22/2024 19:59:29" }, | ||
"instance" : { | ||
"buildResultsTextBoxWith:" : "CG 7/30/2021 19:06", | ||
"buildWith:" : "ms 8/4/2022 11:26", | ||
"getResults" : "leli 5/10/2024 20:50", | ||
"getResults" : "vl 5/22/2024 19:59", | ||
"poll" : "CG 7/30/2021 19:06", | ||
"poll:" : "CG 7/30/2021 19:06" } } |