fossasia/open-event-orga-server

View on GitHub
app/api/order_statistics/events.py

Summary

Maintainability
F
5 days
Test Coverage

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        placed = (
            db.session.query(func.sum(OrderTicket.quantity.label('sum')))
            .join(Order.order_tickets)
            .filter(Order.event_id == obj_id, Order.status == 'placed')
Severity: Major
Found in app/api/order_statistics/events.py and 5 other locations - About 3 hrs to fix
app/api/order_statistics/events.py on lines 44..47
app/api/order_statistics/events.py on lines 50..53
app/api/order_statistics/events.py on lines 56..59
app/api/order_statistics/events.py on lines 62..65
app/api/order_statistics/events.py on lines 74..77

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 62.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        expired = (
            db.session.query(func.sum(OrderTicket.quantity.label('sum')))
            .join(Order.order_tickets)
            .filter(Order.event_id == obj_id, Order.status == 'expired')
Severity: Major
Found in app/api/order_statistics/events.py and 5 other locations - About 3 hrs to fix
app/api/order_statistics/events.py on lines 44..47
app/api/order_statistics/events.py on lines 50..53
app/api/order_statistics/events.py on lines 56..59
app/api/order_statistics/events.py on lines 68..71
app/api/order_statistics/events.py on lines 74..77

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 62.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        cancelled = (
            db.session.query(func.sum(OrderTicket.quantity.label('sum')))
            .join(Order.order_tickets)
            .filter(Order.event_id == obj_id, Order.status == 'cancelled')
Severity: Major
Found in app/api/order_statistics/events.py and 5 other locations - About 3 hrs to fix
app/api/order_statistics/events.py on lines 44..47
app/api/order_statistics/events.py on lines 56..59
app/api/order_statistics/events.py on lines 62..65
app/api/order_statistics/events.py on lines 68..71
app/api/order_statistics/events.py on lines 74..77

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 62.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        draft = (
            db.session.query(func.sum(OrderTicket.quantity.label('sum')))
            .join(Order.order_tickets)
            .filter(Order.event_id == obj_id, Order.status == 'draft')
Severity: Major
Found in app/api/order_statistics/events.py and 5 other locations - About 3 hrs to fix
app/api/order_statistics/events.py on lines 50..53
app/api/order_statistics/events.py on lines 56..59
app/api/order_statistics/events.py on lines 62..65
app/api/order_statistics/events.py on lines 68..71
app/api/order_statistics/events.py on lines 74..77

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 62.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        completed = (
            db.session.query(func.sum(OrderTicket.quantity.label('sum')))
            .join(Order.order_tickets)
            .filter(Order.event_id == obj_id, Order.status == 'completed')
Severity: Major
Found in app/api/order_statistics/events.py and 5 other locations - About 3 hrs to fix
app/api/order_statistics/events.py on lines 44..47
app/api/order_statistics/events.py on lines 50..53
app/api/order_statistics/events.py on lines 56..59
app/api/order_statistics/events.py on lines 62..65
app/api/order_statistics/events.py on lines 68..71

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 62.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        pending = (
            db.session.query(func.sum(OrderTicket.quantity.label('sum')))
            .join(Order.order_tickets)
            .filter(Order.event_id == obj_id, Order.status == 'pending')
Severity: Major
Found in app/api/order_statistics/events.py and 5 other locations - About 3 hrs to fix
app/api/order_statistics/events.py on lines 44..47
app/api/order_statistics/events.py on lines 50..53
app/api/order_statistics/events.py on lines 62..65
app/api/order_statistics/events.py on lines 68..71
app/api/order_statistics/events.py on lines 74..77

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 62.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        result = {
            'total': total or 0,
            'draft': draft or 0,
            'cancelled': cancelled or 0,
            'pending': pending or 0,
Severity: Major
Found in app/api/order_statistics/events.py and 1 other location - About 2 hrs to fix
app/api/order_statistics/events.py on lines 130..137

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 56.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        result = {
            'total': total or 0,
            'draft': draft or 0,
            'cancelled': cancelled or 0,
            'pending': pending or 0,
Severity: Major
Found in app/api/order_statistics/events.py and 1 other location - About 2 hrs to fix
app/api/order_statistics/events.py on lines 178..185

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 56.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        pending = (
            db.session.query(func.sum(Order.amount.label('sum')))
            .filter(Order.event_id == obj_id, Order.status == 'pending')
Severity: Major
Found in app/api/order_statistics/events.py and 5 other locations - About 2 hrs to fix
app/api/order_statistics/events.py on lines 148..150
app/api/order_statistics/events.py on lines 153..155
app/api/order_statistics/events.py on lines 163..165
app/api/order_statistics/events.py on lines 168..170
app/api/order_statistics/events.py on lines 173..175

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 54.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        cancelled = (
            db.session.query(func.sum(Order.amount.label('sum')))
            .filter(Order.event_id == obj_id, Order.status == 'cancelled')
Severity: Major
Found in app/api/order_statistics/events.py and 5 other locations - About 2 hrs to fix
app/api/order_statistics/events.py on lines 148..150
app/api/order_statistics/events.py on lines 158..160
app/api/order_statistics/events.py on lines 163..165
app/api/order_statistics/events.py on lines 168..170
app/api/order_statistics/events.py on lines 173..175

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 54.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        completed = (
            db.session.query(func.sum(Order.amount.label('sum')))
            .filter(Order.event_id == obj_id, Order.status == 'completed')
Severity: Major
Found in app/api/order_statistics/events.py and 5 other locations - About 2 hrs to fix
app/api/order_statistics/events.py on lines 148..150
app/api/order_statistics/events.py on lines 153..155
app/api/order_statistics/events.py on lines 158..160
app/api/order_statistics/events.py on lines 163..165
app/api/order_statistics/events.py on lines 168..170

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 54.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        draft = (
            db.session.query(func.sum(Order.amount.label('sum')))
            .filter(Order.event_id == obj_id, Order.status == 'draft')
Severity: Major
Found in app/api/order_statistics/events.py and 5 other locations - About 2 hrs to fix
app/api/order_statistics/events.py on lines 153..155
app/api/order_statistics/events.py on lines 158..160
app/api/order_statistics/events.py on lines 163..165
app/api/order_statistics/events.py on lines 168..170
app/api/order_statistics/events.py on lines 173..175

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 54.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        expired = (
            db.session.query(func.sum(Order.amount.label('sum')))
            .filter(Order.event_id == obj_id, Order.status == 'expired')
Severity: Major
Found in app/api/order_statistics/events.py and 5 other locations - About 2 hrs to fix
app/api/order_statistics/events.py on lines 148..150
app/api/order_statistics/events.py on lines 153..155
app/api/order_statistics/events.py on lines 158..160
app/api/order_statistics/events.py on lines 168..170
app/api/order_statistics/events.py on lines 173..175

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 54.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        placed = (
            db.session.query(func.sum(Order.amount.label('sum')))
            .filter(Order.event_id == obj_id, Order.status == 'placed')
Severity: Major
Found in app/api/order_statistics/events.py and 5 other locations - About 2 hrs to fix
app/api/order_statistics/events.py on lines 148..150
app/api/order_statistics/events.py on lines 153..155
app/api/order_statistics/events.py on lines 158..160
app/api/order_statistics/events.py on lines 163..165
app/api/order_statistics/events.py on lines 173..175

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 54.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        placed = get_count(
            db.session.query(Order).filter(
                Order.event_id == obj_id, Order.status == 'placed'
Severity: Major
Found in app/api/order_statistics/events.py and 5 other locations - About 1 hr to fix
app/api/order_statistics/events.py on lines 100..102
app/api/order_statistics/events.py on lines 105..107
app/api/order_statistics/events.py on lines 110..112
app/api/order_statistics/events.py on lines 115..117
app/api/order_statistics/events.py on lines 125..127

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 40.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        expired = get_count(
            db.session.query(Order).filter(
                Order.event_id == obj_id, Order.status == 'expired'
Severity: Major
Found in app/api/order_statistics/events.py and 5 other locations - About 1 hr to fix
app/api/order_statistics/events.py on lines 100..102
app/api/order_statistics/events.py on lines 105..107
app/api/order_statistics/events.py on lines 110..112
app/api/order_statistics/events.py on lines 120..122
app/api/order_statistics/events.py on lines 125..127

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 40.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        cancelled = get_count(
            db.session.query(Order).filter(
                Order.event_id == obj_id, Order.status == 'cancelled'
Severity: Major
Found in app/api/order_statistics/events.py and 5 other locations - About 1 hr to fix
app/api/order_statistics/events.py on lines 100..102
app/api/order_statistics/events.py on lines 110..112
app/api/order_statistics/events.py on lines 115..117
app/api/order_statistics/events.py on lines 120..122
app/api/order_statistics/events.py on lines 125..127

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 40.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        completed = get_count(
            db.session.query(Order).filter(
                Order.event_id == obj_id, Order.status == 'completed'
Severity: Major
Found in app/api/order_statistics/events.py and 5 other locations - About 1 hr to fix
app/api/order_statistics/events.py on lines 100..102
app/api/order_statistics/events.py on lines 105..107
app/api/order_statistics/events.py on lines 110..112
app/api/order_statistics/events.py on lines 115..117
app/api/order_statistics/events.py on lines 120..122

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 40.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        pending = get_count(
            db.session.query(Order).filter(
                Order.event_id == obj_id, Order.status == 'pending'
Severity: Major
Found in app/api/order_statistics/events.py and 5 other locations - About 1 hr to fix
app/api/order_statistics/events.py on lines 100..102
app/api/order_statistics/events.py on lines 105..107
app/api/order_statistics/events.py on lines 115..117
app/api/order_statistics/events.py on lines 120..122
app/api/order_statistics/events.py on lines 125..127

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 40.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        draft = get_count(
            db.session.query(Order).filter(
                Order.event_id == obj_id, Order.status == 'draft'
Severity: Major
Found in app/api/order_statistics/events.py and 5 other locations - About 1 hr to fix
app/api/order_statistics/events.py on lines 105..107
app/api/order_statistics/events.py on lines 110..112
app/api/order_statistics/events.py on lines 115..117
app/api/order_statistics/events.py on lines 120..122
app/api/order_statistics/events.py on lines 125..127

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 40.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

There are no issues that match your filters.

Category
Status