Skip to content

Commit 2073562

Browse files
committed
harmonize join type value (0=one-to-many, 1=one-to-one)
1 parent 1542b48 commit 2073562

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -2774,7 +2774,6 @@ tests:
27742774
- algorithm: native:joinattributestable
27752775
name: join the attribute table by common field (one-to-one)
27762776
params:
2777-
METHOD: 0
27782777
INPUT:
27792778
name: points.gml
27802779
type: vector
@@ -2791,7 +2790,7 @@ tests:
27912790
- algorithm: native:joinattributestable
27922791
name: join the attribute table by common field, discard non matching (one-to-one)
27932792
params:
2794-
METHOD: 0
2793+
METHOD: 1
27952794
INPUT:
27962795
name: points.gml
27972796
type: vector
@@ -2809,7 +2808,7 @@ tests:
28092808
- algorithm: native:joinattributestable
28102809
name: join the attribute table by common field (one-to-many)
28112810
params:
2812-
METHOD: 1
2811+
METHOD: 0
28132812
INPUT:
28142813
name: points.gml
28152814
type: vector
@@ -2826,7 +2825,6 @@ tests:
28262825
- algorithm: native:joinattributestable
28272826
name: Join attributes table with subset of fields
28282827
params:
2829-
METHOD: 0
28302828
FIELD: id
28312829
FIELDS_TO_COPY:
28322830
- NUM_A

src/analysis/processing/qgsalgorithmjoinbyattribute.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ QString QgsJoinByAttributeAlgorithm::groupId() const
4747
void QgsJoinByAttributeAlgorithm::initAlgorithm( const QVariantMap & )
4848
{
4949
QStringList methods;
50-
methods << QObject::tr( "Take attributes of the first matching feature only (one-to-one)" )
51-
<< QObject::tr( "Create separate feature for each matching feature (one-to-many)" );
50+
methods << QObject::tr( "Create separate feature for each matching feature (one-to-many)" )
51+
<< QObject::tr( "Take attributes of the first matching feature only (one-to-one)" );
5252

5353
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ),
5454
QObject::tr( "Input layer" ), QList< int>() << QgsProcessing::TypeVector ) );
@@ -67,7 +67,7 @@ void QgsJoinByAttributeAlgorithm::initAlgorithm( const QVariantMap & )
6767

6868
addParameter( new QgsProcessingParameterEnum( QStringLiteral( "METHOD" ),
6969
QObject::tr( "Join type" ),
70-
methods, false, 0 ) );
70+
methods, false, 1 ) );
7171
addParameter( new QgsProcessingParameterBoolean( QStringLiteral( "DISCARD_NONMATCHING" ),
7272
QObject::tr( "Discard records which could not be joined" ),
7373
false ) );
@@ -158,7 +158,7 @@ QVariantMap QgsJoinByAttributeAlgorithm::processAlgorithm( const QVariantMap &pa
158158

159159
feedback->setProgress( i * step );
160160

161-
if ( joinMethod == 0 && input2AttributeCache.contains( feat.attribute( joinField2Index ) ) )
161+
if ( joinMethod == 1 && input2AttributeCache.contains( feat.attribute( joinField2Index ) ) )
162162
continue;
163163

164164
// only keep selected attributes

0 commit comments

Comments
 (0)