Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tallty_import_export
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
tallty_import_export
Commits
482a9691
Commit
482a9691
authored
Nov 05, 2023
by
liyijie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add record ta_statistic & ta_statistics attr_accessor support
parent
6cba9b85
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
7 deletions
+11
-7
export.rb
lib/tallty_import_export/export.rb
+2
-0
export_form.rb
lib/tallty_import_export/export_form.rb
+7
-5
import.rb
lib/tallty_import_export/import.rb
+2
-2
No files found.
lib/tallty_import_export/export.rb
View file @
482a9691
...
...
@@ -131,6 +131,8 @@ module TalltyImportExport
[
association_record
]
records
.
each
do
|
record
|
record
.
ta_statistics
=
record
.
ta_statistic
(
options
[
:resource_stat_condition
])
if
options
[
:resource_stat_condition
].
present?
row
=
[]
formats
=
[]
index
+=
1
...
...
lib/tallty_import_export/export_form.rb
View file @
482a9691
...
...
@@ -61,6 +61,8 @@ module TalltyImportExport
[
association_record
]
records
.
each
do
|
record
|
record
.
ta_statistics
=
record
.
ta_statistic
(
options
[
:resource_stat_condition
])
if
options
[
:resource_stat_condition
].
present?
value_living_alone_col_index_to_value_count
=
{}
payload
=
TalltyImportExport
::
ExportPayload
.
new
(
record
,
header:
header_obj
)
do
|
payload
,
header
,
**
opts
|
...
...
@@ -95,11 +97,11 @@ module TalltyImportExport
# 合并仅有一个值的一列中所有格子
value_living_alone_col_index_to_value_count
.
each_pair
do
|
col_index
,
count
|
if
count
==
1
sheet
.
merge_cells
(
Axlsx
::
cell_r
(
col_index
,
index
)
+
':'
+
Axlsx
::
cell_r
(
col_index
,
index
+
payload
.
max_matrix_height
-
1
)
)
end
next
unless
count
==
1
sheet
.
merge_cells
(
Axlsx
.
cell_r
(
col_index
,
index
)
+
':'
+
Axlsx
.
cell_r
(
col_index
,
index
+
payload
.
max_matrix_height
-
1
),
)
end
index
+=
payload
.
max_matrix_height
...
...
lib/tallty_import_export/import.rb
View file @
482a9691
...
...
@@ -168,12 +168,12 @@ module TalltyImportExport
end
.
with_indifferent_access
end
def
handle_attr_type
val
,
header
,
line_info
def
handle_attr_type
(
val
,
header
,
line_info
)
case
header
[
:attr_type
].
to_s
when
'file'
if
val
.
is_a?
(
String
)
val
.
split
(
"
\n
"
).
map
do
|
url
|
params
=
url
.
include?
(
'?'
)
?
CGI
::
parse
(
url
.
split
(
'?'
).
last
)
:
{}
params
=
url
.
include?
(
'?'
)
?
CGI
.
parse
(
url
.
split
(
'?'
).
last
)
:
{}
{
url:
url
,
fileName:
params
[
'fileName'
]
&
.
first
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment