Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Kemence
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Disappointment industries™
Kemence
Commits
58e4ab0f
Commit
58e4ab0f
authored
3 years ago
by
Tóth Miklós Tibor
Browse files
Options
Downloads
Patches
Plain Diff
Error memes
parent
f1ff5401
Branches
master
No related tags found
No related merge requests found
Pipeline
#31320
passed
3 years ago
Stage: build
Stage: package
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/jsMain/kotlin/datasources/GSheet.kt
+15
-13
15 additions, 13 deletions
src/jsMain/kotlin/datasources/GSheet.kt
with
15 additions
and
13 deletions
src/jsMain/kotlin/datasources/GSheet.kt
+
15
−
13
View file @
58e4ab0f
...
...
@@ -9,7 +9,7 @@ import pekstuff.trimAsPrinciple
import
kotlin.coroutines.resume
import
kotlin.coroutines.suspendCoroutine
class
GSheet
private
constructor
(
sheet
:
sheets
.
Spreadsheet
,
sheetNum
:
Int
=
0
):
DataSource
,
NoteDataSource
{
class
GSheet
private
constructor
(
val
sheet
:
sheets
.
Spreadsheet
,
sheetNum
:
Int
=
0
):
DataSource
,
NoteDataSource
{
companion
object
{
private
val
filterList
=
listOf
(
"szumma"
,
"színes belépő"
...
...
@@ -18,7 +18,6 @@ class GSheet private constructor(sheet: sheets.Spreadsheet, sheetNum: Int = 0):
suspend
fun
new
(
url
:
String
,
sheetNum
:
Int
=
0
):
GSheet
{
if
(!
isSignedIn
)
throw
Error
(
"You must sign in to get gapi.sheets"
)
val
sheet
=
getSheetFromUrl
(
url
)
window
.
asDynamic
().
test
=
sheet
return
GSheet
(
sheet
,
sheetNum
)
}
...
...
@@ -36,19 +35,19 @@ class GSheet private constructor(sheet: sheets.Spreadsheet, sheetNum: Int = 0):
}
}
private
val
rows
=
sheet
.
sheets
!!
[
sheetNum
]
.
data
!!
[
0
].
rowData
!!
private
val
rows
=
sheet
.
sheets
?.
get
(
sheetNum
)
?
.
data
?.
get
(
0
)
?.
rowData
?:
throw
SheetException
(
"NullPtrError"
,
this
)
private
val
principleIndexes
=
rows
[
0
].
values
!!
.
mapIndexed
{
i
,
data
->
private
val
principleIndexes
=
rows
[
0
].
values
?
.
mapIndexed
{
i
,
data
->
(
data
.
formattedValue
?.
trimAsPrinciple
()
?:
""
)
to
i
}.
drop
(
1
).
filter
{
}
?
.
drop
(
1
)
?
.
filter
{
filterList
.
all
{
filter
->
!
it
.
first
.
lowercase
().
contains
(
filter
)
}
&&
it
.
first
.
isNotBlank
()
}.
toMap
()
}
?
.
toMap
()
?:
throw
SheetException
(
"NullPtrException principles"
,
this
)
override
val
principles
get
()
=
principleIndexes
.
keys
private
val
peopleIndexes
=
rows
.
mapIndexed
{
i
,
data
->
(
data
.
values
!!
[
0
]
.
formattedValue
?:
""
)
to
i
}
.
mapIndexed
{
i
,
data
->
(
data
.
values
?.
get
(
0
)
?
.
formattedValue
?:
""
)
to
i
}
.
drop
(
1
)
.
filter
{
it
.
first
.
isNotBlank
()
}
.
toMap
()
...
...
@@ -56,14 +55,17 @@ class GSheet private constructor(sheet: sheets.Spreadsheet, sheetNum: Int = 0):
override
val
people
get
()
=
peopleIndexes
.
keys
override
operator
fun
get
(
person
:
String
,
principle
:
String
):
Int
{
val
pers
=
peopleIndexes
[
person
]
!!
val
princ
=
principleIndexes
[
principle
]
!!
return
rows
[
pers
].
values
!!
[
princ
]
.
formattedValue
!!
.
toIntOrNull
()
?:
0
val
pers
=
peopleIndexes
[
person
]
?:
throw
Error
(
"person $person"
)
val
princ
=
principleIndexes
[
principle
]
?:
throw
Error
(
"principle $principle"
)
return
rows
[
pers
].
values
?.
get
(
princ
)
?
.
formattedValue
?
.
toIntOrNull
()
?:
0
}
override
fun
getNote
(
person
:
String
,
principle
:
String
):
String
{
val
pers
=
peopleIndexes
[
person
]
!!
val
princ
=
principleIndexes
[
principle
]
!!
return
rows
[
pers
].
values
!!
[
princ
]
.
note
?:
""
val
pers
=
peopleIndexes
[
person
]
?:
throw
Error
(
"person $person not found"
)
val
princ
=
principleIndexes
[
principle
]
?:
throw
Error
(
"principle $principle not found"
)
return
rows
[
pers
].
values
?.
get
(
princ
)
?
.
note
?:
""
}
}
class
SheetException
(
str
:
String
,
val
sheet
:
GSheet
):
Exception
(
str
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment