Skip to content

Commit 0f83c33

Browse files
committed
fix(series import): show seller-related fields where only price and currency were extracted.
Fix #1232
1 parent a16c41b commit 0f83c33

File tree

8 files changed

+155
-3
lines changed

8 files changed

+155
-3
lines changed

src/main/resources/liquibase/changelog.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@
1313
<include file="version/0.4.xml" relativeToChangelogFile="true" />
1414
<include file="version/0.4.1.xml" relativeToChangelogFile="true" />
1515
<include file="version/0.4.2.xml" relativeToChangelogFile="true" />
16+
17+
<include file="test-data.xml" relativeToChangelogFile="true" />
1618

1719
</databaseChangeLog>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<databaseChangeLog
3+
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
6+
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
7+
8+
<include file="test-data/transaction_participants.xml" relativeToChangelogFile="true" />
9+
10+
<!-- Depends on: series_import_request_statuses, users -->
11+
<include file="test-data/series_import_requests.xml" relativeToChangelogFile="true" />
12+
13+
<!-- Depends on: series_import_requests, transaction_participants -->
14+
<include file="test-data/series_import_parsed_data.xml" relativeToChangelogFile="true" />
15+
16+
<!-- Depends on: series_import_requests -->
17+
<include file="test-data/series_sales_import_parsed_data.xml" relativeToChangelogFile="true" />
18+
19+
</databaseChangeLog>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<databaseChangeLog
3+
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
6+
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
7+
8+
<changeSet id="add-series-parsed-data-for-gh1232" author="php-coder" context="test-data">
9+
10+
<insert tableName="series_import_parsed_data">
11+
<column name="request_id" valueComputed="(SELECT id FROM series_import_requests WHERE url = 'http://example.com/issue/1232')" />
12+
<column name="created_at" valueComputed="${NOW}" />
13+
<column name="updated_at" valueComputed="${NOW}" />
14+
</insert>
15+
16+
<insert tableName="series_import_parsed_data">
17+
<column name="request_id" valueComputed="(SELECT id FROM series_import_requests WHERE url = 'http://example.com/issue/1232/with-seller-id')" />
18+
<column name="created_at" valueComputed="${NOW}" />
19+
<column name="updated_at" valueComputed="${NOW}" />
20+
</insert>
21+
22+
</changeSet>
23+
24+
</databaseChangeLog>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<databaseChangeLog
3+
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
6+
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
7+
8+
<changeSet id="add-import-request-for-gh1232" author="php-coder" context="test-data">
9+
10+
<insert tableName="series_import_requests">
11+
<column name="url" value="http://example.com/issue/1232" />
12+
<column name="status_id" valueComputed="(SELECT id FROM series_import_request_statuses WHERE name = 'ParsingSucceeded')" />
13+
<column name="requested_at" valueComputed="${NOW}" />
14+
<column name="requested_by" valueComputed="(SELECT id FROM users WHERE role = 'ADMIN' ORDER by id LIMIT 1)" />
15+
<column name="updated_at" valueComputed="${NOW}" />
16+
</insert>
17+
18+
<insert tableName="series_import_requests">
19+
<column name="url" value="http://example.com/issue/1232/with-seller-id" />
20+
<column name="status_id" valueComputed="(SELECT id FROM series_import_request_statuses WHERE name = 'ParsingSucceeded')" />
21+
<column name="requested_at" valueComputed="${NOW}" />
22+
<column name="requested_by" valueComputed="(SELECT id FROM users WHERE role = 'ADMIN' ORDER by id LIMIT 1)" />
23+
<column name="updated_at" valueComputed="${NOW}" />
24+
</insert>
25+
26+
</changeSet>
27+
28+
</databaseChangeLog>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<databaseChangeLog
3+
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
6+
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
7+
8+
<changeSet id="add-series-sale-without-seller-info-but-with-price" author="php-coder" context="test-data">
9+
10+
<insert tableName="series_sales_import_parsed_data">
11+
<column name="request_id" valueComputed="(SELECT id FROM series_import_requests WHERE url = 'http://example.com/issue/1232')" />
12+
<column name="price" valueNumeric="100" />
13+
<column name="currency" value="RUB" />
14+
<column name="created_at" valueComputed="${NOW}" />
15+
<column name="updated_at" valueComputed="${NOW}" />
16+
</insert>
17+
18+
<insert tableName="series_sales_import_parsed_data">
19+
<column name="request_id" valueComputed="(SELECT id FROM series_import_requests WHERE url = 'http://example.com/issue/1232/with-seller-id')" />
20+
<column name="seller_id" valueNumeric="(SELECT id FROM transaction_participants WHERE url = 'http://example.com/issue/1232/with-seller-id')" />
21+
<column name="price" valueNumeric="100" />
22+
<column name="currency" value="RUB" />
23+
<column name="created_at" valueComputed="${NOW}" />
24+
<column name="updated_at" valueComputed="${NOW}" />
25+
</insert>
26+
27+
</changeSet>
28+
29+
</databaseChangeLog>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<databaseChangeLog
3+
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
6+
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
7+
8+
<changeSet id="add-participant-for-gh1232" author="php-coder" context="test-data">
9+
10+
<insert tableName="transaction_participants">
11+
<column name="name" value="gh1232" />
12+
<column name="url" value="http://example.com/issue/1232/with-seller-id" />
13+
<column name="is_buyer" valueBoolean="false" />
14+
<column name="is_seller" valueBoolean="true" />
15+
</insert>
16+
17+
</changeSet>
18+
19+
</databaseChangeLog>

src/main/webapp/WEB-INF/views/series/import/info.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,8 @@ <h3 th:text="#{t_gathered_data}">
360360
</tr>
361361
/*/-->
362362

363-
<tr th:if="${hasSellerInfo and importSeriesForm.seller.groupId != null}" th:classappend="${#fields.hasErrors('seller.groupId') ? 'has-error' : ''}">
363+
<tr th:if="${(hasSellerInfo and importSeriesForm.seller.groupId != null) or (hasSalesInfo and importSeriesForm.seriesSale.sellerId == null)}"
364+
th:classappend="${#fields.hasErrors('seller.groupId') ? 'has-error' : ''}">
364365
<th>
365366
<label for="seller-group" class="control-label" th:text="#{t_seller_group}">
366367
Seller group
@@ -390,7 +391,8 @@ <h3 th:text="#{t_gathered_data}">
390391
</td>
391392
</tr>
392393

393-
<tr th:if="${hasSellerInfo and importSeriesForm.seller.name != null}" th:classappend="${#fields.hasErrors('seller.name') ? 'has-error' : ''}">
394+
<tr th:if="${(hasSellerInfo and importSeriesForm.seller.name != null) or (hasSalesInfo and importSeriesForm.seriesSale.sellerId == null)}"
395+
th:classappend="${#fields.hasErrors('seller.name') ? 'has-error' : ''}">
394396
<th>
395397
<label for="seller-name" class="control-label" th:text="#{t_seller_name}">
396398
Seller name
@@ -413,7 +415,8 @@ <h3 th:text="#{t_gathered_data}">
413415
</td>
414416
</tr>
415417

416-
<tr th:if="${hasSellerInfo and importSeriesForm.seller.url != null}" th:classappend="${#fields.hasErrors('seller.url') ? 'has-error' : ''}">
418+
<tr th:if="${(hasSellerInfo and importSeriesForm.seller.url != null) or (hasSalesInfo and importSeriesForm.seriesSale.sellerId == null)}"
419+
th:classappend="${#fields.hasErrors('seller.url') ? 'has-error' : ''}">
417420
<th>
418421
<label for="seller-url" class="control-label" th:text="#{t_seller_url}">
419422
Seller URL
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
*** Settings ***
2+
Documentation Miscellaneous aspects of a series import
3+
Library SeleniumLibrary
4+
Resource ../../auth.steps.robot
5+
Suite Setup Before Test Suite
6+
Suite Teardown Close Browser
7+
Force Tags series import-series misc
8+
9+
*** Test Cases ***
10+
Seller info should be visible where only price and currency have been extracted
11+
Go To ${SITE_URL}/series/import/request/3
12+
Element Text Should Be id:request-url http://example.com/issue/1232
13+
Element Should Be Visible id:seller-group
14+
Element Should Be Visible id:seller-name
15+
Element Should Be Visible id:seller-url
16+
17+
Seller info should be invisible where seller id has been extracted
18+
Go To ${SITE_URL}/series/import/request/4
19+
List Selection Should Be id:seller gh1232
20+
Element Should Not Be Visible id:seller-group
21+
Element Should Not Be Visible id:seller-name
22+
Element Should Not Be Visible id:seller-url
23+
24+
*** Keywords ***
25+
Before Test Suite
26+
Open Browser ${SITE_URL}/account/auth ${BROWSER}
27+
Register Keyword To Run On Failure Log Source
28+
Log In As login=admin password=test

0 commit comments

Comments
 (0)