-
Notifications
You must be signed in to change notification settings - Fork 253
Conversation
@@ -0,0 +1,45 @@ | |||
# Generated by Django 3.2.20 on 2023-11-08 13:55 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This migration need changes to avoid price loss.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This migration is dropping 3 already deprecated fields from the Line model. From the read replica, I have found that we have data in these two columns (unit_retail_price
and unit_cost_price
). Out of 32 million records, only 384
rows have non-null/non-zero values in these columns.
I haven't found any reference in our codebase about these fields, so are we ok with the deletion of these fields or should we preserve them? Need suggestion from someone with better business domain knowledge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the sake of this PR, we (2U) wouldn't be affected, as this is just going to master. We when we make PRs for 2u/main branch, I think we should revisit this question then, particularly with the eyes of @dmsuter
That said, if there is an easy way to avoid this data from being lost for the sake of master branch, then I think for this PR we should do that out of courtesy for the community
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we can preserve these fields, we can add these fields to the forked version of this model here.
chore: updated factory dependency refactor: updated field name feat: Mgmt Command to create mobile seats for new course runs (#4046) fix: skipped a failing test. Will fix it in another ticket fix: updated method refactor: made changes as per new version of oscar refactor: updated code to make voucher name unique fix: removed white spaces fix: removed white spaces refactor: changed code as per new version of oscar refactor: updated code fix: override Product model in catalogue app fix: removed extra spaces fix: updated code fix: changes in code to pass checks fix: changes in code to pass checks
955e4d3
to
a8acca8
Compare
Simple Checklist for sandbox testing:
These changes are not reversible. So need proper testing from QA side. |
99de787
to
ddbfe3e
Compare
ddbfe3e
to
28f8cb6
Compare
""" | ||
|
||
class Meta: | ||
model = StockRecord | ||
fields = ('price_currency', 'price_excl_tax',) | ||
fields = ('price_currency', 'price',) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will break mobile apps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes discussed with mobile team
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will also break financial reporting; where is it being tested and when is this scheduled to be moved to production?
…mmerce into zubair-django-oscar31-update
@zubair-ce07 @mumarkhan999 I think we can avoid vouchers change. We are overriding this model, so if declare field here without |
@@ -374,6 +374,13 @@ def update(self, request, *args, **kwargs): | |||
def update_voucher_data(self, request_data, vouchers): | |||
data = self.create_update_data_dict(data=request_data, fields=CouponVouchers.UPDATEABLE_VOUCHER_FIELDS) | |||
if data: | |||
if 'name' in data: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are exposing voucher code with name. Also any test case for this change ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Django Oscar is also doing the same with old vouchers (appending voucher id to voucher name to make it unique). So I'm guessing it's safe to append voucher id. Regarding the test case, there is already one. We can update it according to the change.
name='price_excl_tax', | ||
field=models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True, verbose_name='Price'), | ||
), | ||
migrations.RenameField( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This migration is moving data from old to new column
from django.db import migrations | ||
|
||
|
||
def make_voucher_names_unique(apps, schema_editor): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mumarkhan999 u also need to add test for this migration.
@@ -0,0 +1,49 @@ | |||
# Generated by Django 3.2.20 on 2023-11-08 13:55 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rawsql
against this migration
file
--
-- Remove field cost_price from historicalstockrecord
--
ALTER TABLE `partner_historicalstockrecord` DROP COLUMN `cost_price`;
--
-- Remove field price_retail from historicalstockrecord
--
ALTER TABLE `partner_historicalstockrecord` DROP COLUMN `price_retail`;
--
-- Remove field cost_price from stockrecord
--
ALTER TABLE `partner_stockrecord` DROP COLUMN `cost_price`;
--
-- Remove field price_retail from stockrecord
--
ALTER TABLE `partner_stockrecord` DROP COLUMN `price_retail`;
--
-- Alter field price_excl_tax on historicalstockrecord
--
--
-- Rename field price_excl_tax on historicalstockrecord to price
--
ALTER TABLE `partner_historicalstockrecord` RENAME COLUMN `price_excl_tax` TO `price`;
--
-- Alter field price_excl_tax on stockrecord
--
--
-- Rename field price_excl_tax on stockrecord to price
--
ALTER TABLE `partner_stockrecord` RENAME COLUMN `price_excl_tax` TO `price`;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[inform] These tables have ~500k and ~77k records.
Appends a number to voucher names. | ||
""" | ||
Voucher = apps.get_model('voucher', 'Voucher') | ||
vouchers = Voucher.objects.order_by('date_created') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…mmerce into zubair-django-oscar31-update
This PR has ran these migrations on sandbox
|
@@ -4,21 +4,20 @@ | |||
from django.db import migrations, models | |||
from oscar.core.loading import get_model | |||
|
|||
Option = get_model('catalogue', 'Option') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iamsobanjaved Please double check this migration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine, just getting the historical state of the model instead of the latest state.
@@ -23,12 +23,10 @@ def _store_form_kwargs(self, form): | |||
session_data[self._key()] = json_data | |||
self.request.session.save() | |||
|
|||
def _fetch_form_kwargs(self, step_name=None): | |||
def _fetch_form_kwargs(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -1,738 +1,737 @@ | |||
{% extends 'oscar/dashboard/layout.html' %} | |||
{% load i18n %} | |||
{% load compress %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why removed these ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reviewed all the changes and except one or two (mentioned in comments) everything looks fine. I couldn't review changes in the HTML files as I lacked context and domain knowledge.
@@ -62,6 +62,7 @@ def post_delete(self, instance, using=None, **kwargs): | |||
|
|||
|
|||
class Product(AbstractProduct): | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change required?
@@ -168,6 +168,7 @@ def test_processing_failure(self, approve): | |||
'Please try again, or contact the E-Commerce Development Team.'.format(refund_id=refund_id) | |||
) | |||
|
|||
@skip("Failing for some unknown reason, will fix it in another ticket.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to skip this one, we need to do manual QA for what this test is doing
migrations.AlterField( | ||
model_name='productattributevalue', | ||
name='value_boolean', | ||
field=models.BooleanField(blank=True, db_index=True, null=True, verbose_name='Boolean'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Inform] This table has 242k records in the database.
migrations.AlterField( | ||
model_name='productalert', | ||
name='date_created', | ||
field=models.DateTimeField(auto_now_add=True, db_index=True, verbose_name='Date created'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[inform] This is adding db_index but we don't have any data in this model.
@@ -0,0 +1,45 @@ | |||
# Generated by Django 3.2.20 on 2023-11-08 13:55 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This migration is dropping 3 already deprecated fields from the Line model. From the read replica, I have found that we have data in these two columns (unit_retail_price
and unit_cost_price
). Out of 32 million records, only 384
rows have non-null/non-zero values in these columns.
I haven't found any reference in our codebase about these fields, so are we ok with the deletion of these fields or should we preserve them? Need suggestion from someone with better business domain knowledge.
@@ -0,0 +1,49 @@ | |||
# Generated by Django 3.2.20 on 2023-11-08 13:55 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[inform] These tables have ~500k and ~77k records.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests in the sandbox environment was successful, so I am giving my 👍 with 1 question:
Earlier in the review process there was mention of 1 column being deleted and recreated as a new name (instead of the column being simply renamed, therefore potentially leading to data loss).
Can someone confirm that is no longer an issue? If it is not an issue, we should be okay to merge.
Yes we have changed that migration. Here is the migration path ecommerce/extensions/partner/migrations/0019_auto_20231108_1355.py |
All tests passed on sandbox. Also verified on local and everything is working fine. Merging this PR here. |
The Django Oscar upgrade of ecommerce changed the item's price field from `price_excl_tax` to just `price` causing the EcommerceApi data loader to fail. This commit handled the exception and falls back to the 'price' value. Ref: openedx-unsupported/ecommerce#4050
The Django Oscar upgrade of ecommerce changed the item's price field from `price_excl_tax` to just `price` causing the EcommerceApi data loader to fail. This commit handled the exception and falls back to the 'price' value. Ref: openedx-unsupported/ecommerce#4050
The Django Oscar upgrade of ecommerce changed the item's price field from `price_excl_tax` to just `price` causing the EcommerceApi data loader to fail. This commit checks for the `price_excl_tax` key and falls back to the 'price' value. Ref: openedx-unsupported/ecommerce#4050
The Django Oscar upgrade of ecommerce changed the item's price field from `price_excl_tax` to just `price` causing the EcommerceApi data loader to fail. This commit checks for the `price_excl_tax` key and falls back to the 'price' value. Ref: openedx-unsupported/ecommerce#4050
The Django Oscar upgrade of ecommerce changed the item's price field from price_excl_tax to just price causing the EcommerceApi data loader to fail. This commit handles the exception and falls back to the 'price' value. Ref: openedx-unsupported/ecommerce#4050
* chore: bump upload-artifact GH task to v4 * fix: fallback to 'price' in ecommerce api loader The Django Oscar upgrade of ecommerce changed the item's price field from `price_excl_tax` to just `price` causing the EcommerceApi data loader to fail. This commit checks for the `price_excl_tax` key and falls back to the 'price' value. Ref: openedx-unsupported/ecommerce#4050 * refactor: apply review suggestion on fix * fix: update all references of `price_excl_tax` to price * fix: remove extra item added accidentally
* chore: bump upload-artifact GH task to v4 * fix: fallback to 'price' in ecommerce api loader The Django Oscar upgrade of ecommerce changed the item's price field from `price_excl_tax` to just `price` causing the EcommerceApi data loader to fail. This commit checks for the `price_excl_tax` key and falls back to the 'price' value. Ref: openedx-unsupported/ecommerce#4050 * refactor: apply review suggestion on fix * fix: update all references of `price_excl_tax` to price * fix: remove extra item added accidentally
⛔️ DEPRECATION WARNING
This repository is deprecated and in maintainence-only operation while we work on a replacement, please see this announcement for more information.
Although we have stopped integrating new contributions, we always appreciate security disclosures and patches sent to [email protected]
Anyone internally merging to this repository is expected to release and monitor their changes; if you are not able to do this DO NOT MERGE, please coordinate with someone who can to ensure that the changes are released.
Required Testing
(^ We can remove that manual check once REV-2624 is done and the corresponding e2e test runs again)
Description
Describe what this pull request changes, and why these changes were made. How will these changes affect other people, installations of edx, etc.?
Please include links to any relevant ADRs, design artifacts, and decision documents. Make sure to document the rationale behind significant changes in the repo, per OEP-19, and can be
linked here.
Useful information to include:
Supporting information
Link to other information about the change, such as Jira issues, GitHub issues, or Discourse discussions.
Be sure to check they are publicly readable, or if not, repeat the information here.
Testing instructions
Please provide detailed step-by-step instructions for testing this change; how did YOU test this change?
Other information
Include anything else that will help reviewers and consumers understand the change.