Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prod release #783

Merged
merged 190 commits into from Nov 10, 2020
Merged

Prod release #783

merged 190 commits into from Nov 10, 2020

Conversation

depsiatwal
Copy link
Contributor

Prod release

depsiatwal and others added 30 commits May 1, 2020 16:05
…ectory-api into MVP-395-cache-com-trade-data
Personalise events by user sector and country of interest
Post deployment changelog update
…-cache-task

MVP-474 add tasks for caching comtrade
…nies

MVP-432 fixed adding countries error
bobmeredith and others added 26 commits October 19, 2020 13:50
…nstants

 GP2-699-swamp-route-to-market-constants
* Bump directory-sso-client version (#763)

* fix cc when empty (#764)

Co-authored-by: Gurdeep Atwal <44236490+depsiatwal@users.noreply.github.com>

Co-authored-by: Gurdeep Atwal <44236490+depsiatwal@users.noreply.github.com>
* Bump directory-sso-client version (#763)

* fix cc when empty (#764)

* update constants

* show route to market admin (#767)

* Added Countries and SeletedCountries Model and relevant data (#768)

* Staging release (#765) (#769)

* Bump directory-sso-client version (#763)

* fix cc when empty (#764)

Co-authored-by: Gurdeep Atwal <44236490+depsiatwal@users.noreply.github.com>

Co-authored-by: Gurdeep Atwal <44236490+depsiatwal@users.noreply.github.com>

Co-authored-by: Gurdeep Atwal <44236490+depsiatwal@users.noreply.github.com>
Co-authored-by: gatwal <gurdeep.atwal@digital.trade.gov.uk>
Co-authored-by: Robert Meredith <bob.meredith@ntlworld.com>
New hawk authenticated endpoint at /activity-stream/companies
…tream-endpoint

Add companies endpoint for activity stream
Added new env var for API's request key
…arket-data

Added endpoint for target market data
Copy link

@code-review-doctor code-review-doctor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few issues.

class HsCodeSector(models.Model):
hs_code = models.CharField(max_length=10)
product = models.TextField()
sector = models.CharField(max_length=255, blank=True, null=True)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sector = models.CharField(max_length=255, blank=True, null=True)
sector = models.CharField(max_length=255, blank=True, default='')

null=True on a string field causes inconsistent data types because the value can be either str or None. This adds complexity and maybe bugs, but can be solved by replacing null=True with default="".



class WorldEconomicOutlook(TimeStampedModel):
country_code = models.CharField(unique=False, blank=False, null=False, max_length=50)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
country_code = models.CharField(unique=False, blank=False, null=False, max_length=50)
country_code = models.CharField(max_length=50)

False is the default value Django uses for unique, so unique=False can be removed.

As above, redundant default arguments can be removed.

As above, redundant default arguments can be removed.


class WorldEconomicOutlook(TimeStampedModel):
country_code = models.CharField(unique=False, blank=False, null=False, max_length=50)
country_name = models.CharField(unique=False, blank=False, null=False, max_length=255)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
country_name = models.CharField(unique=False, blank=False, null=False, max_length=255)
country_name = models.CharField(max_length=255)

Likewise, redundant default arguments can be removed.

Same as above: redundant default arguments can be removed.

Likewise, redundant default arguments can be removed.

dataservices/models.py Show resolved Hide resolved
country_code = models.CharField(unique=False, blank=False, null=False, max_length=50)
country_name = models.CharField(unique=False, blank=False, null=False, max_length=255)
subject = models.CharField(unique=False, blank=False, null=False, max_length=100)
scale = models.CharField(unique=False, blank=False, null=False, max_length=100)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
scale = models.CharField(unique=False, blank=False, null=False, max_length=100)
scale = models.CharField(max_length=100)

As above, redundant default arguments can be removed.

As above, redundant default arguments can be removed.

Again, redundant default arguments can be removed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh dear it's duplicating the messages :(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hahah @richtier don't worry iterative process

promotion_channels = JSONField(null=True, blank=True, default=list)
resource_needed = models.TextField(null=True, blank=True, default='', validators=[no_html])
spend_marketing = models.FloatField(null=True, default=None, unique=False)


class CompanyObjectives(TimeStampedModel):
description = models.TextField(null=True, blank=True, default='', validators=[no_html])
owner = models.PositiveIntegerField(null=True, verbose_name='sso user.sso_id', default=None, unique=False)
planned_reviews = models.TextField(blank=True, default='', validators=[no_html])
owner = models.TextField(null=True, blank=True, max_length=100)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
owner = models.TextField(null=True, blank=True, max_length=100)
owner = models.TextField(default='', blank=True, max_length=100)

null=True on a string field causes inconsistent data types because the value can be either str or None. This adds complexity and maybe bugs, but can be solved by replacing null=True with default="".

companyexportplan = models.ForeignKey(
CompanyExportPlan, related_name='company_objectives', on_delete=models.CASCADE
)


class RouteToMarkets(TimeStampedModel):
route = models.CharField(max_length=30, blank=True, null=True, default='', choices=choices.MARKET_ROUTE_CHOICES)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above: consider replacing null=True with default="" (and blank=True to pass validation checks).

companyexportplan = models.ForeignKey(
CompanyExportPlan, related_name='company_objectives', on_delete=models.CASCADE
)


class RouteToMarkets(TimeStampedModel):
route = models.CharField(max_length=30, blank=True, null=True, default='', choices=choices.MARKET_ROUTE_CHOICES)
promote = models.CharField(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above, consider replacing null=True with default="" (and blank=True to pass validation checks).

Comment on lines +24 to +29
country = models.ForeignKey(
'dataservices.Country',
verbose_name=_('Suggested Countries'),
on_delete=models.SET_NULL,
null=True
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
country = models.ForeignKey(
'dataservices.Country',
verbose_name=_('Suggested Countries'),
on_delete=models.SET_NULL,
null=True
)
country = models.ForeignKey('dataservices.Country', verbose_name=_('Suggested Countries'), on_delete=models.SET_NULL, null=True, blank=True)

Django automatically creates a related_name if it's not set. If it were set then a more readable and explicit relationship is set up.

Expect unwanted behavior if null and blank are different values: null controls if the database allows no value for country and blank controls if the application allows no value for country. Consider setting null and blank to the same value for country.

def __str__(self):
return str(self.hs_code)

class Meta:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to Django internal style guide, Meta should come before __str__.

@codecov
Copy link

codecov bot commented Nov 10, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@04799d2). Click here to learn what that means.
The diff coverage is 99.19%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #783   +/-   ##
=========================================
  Coverage          ?   97.02%           
=========================================
  Files             ?      107           
  Lines             ?     3467           
  Branches          ?        0           
=========================================
  Hits              ?     3364           
  Misses            ?      103           
  Partials          ?        0           
Impacted Files Coverage Δ
company/documents.py 100.00% <ø> (ø)
company/serializers.py 100.00% <ø> (ø)
conf/urls.py 100.00% <ø> (ø)
personalisation/models.py 95.65% <90.00%> (ø)
dataservices/views.py 95.72% <96.10%> (ø)
dataservices/models.py 98.30% <97.72%> (ø)
activitystream/serializers.py 100.00% <100.00%> (ø)
activitystream/views.py 96.42% <100.00%> (ø)
company/helpers.py 100.00% <100.00%> (ø)
...mpany/management/commands/elasticsearch_migrate.py 100.00% <100.00%> (ø)
... and 130 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 04799d2...a6c76ff. Read the comment docs.

@depsiatwal depsiatwal merged commit f47e9ab into master Nov 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants