Skip to content

Commit

Permalink
rename new_scrapings
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennecallies committed Nov 17, 2024
1 parent a75ee58 commit 29e8861
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
18 changes: 18 additions & 0 deletions home/migrations/0132_alter_scraping_prunings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.0.9 on 2024-11-17 11:28

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('home', '0131_remove_scraping_pruning'),
]

operations = [
migrations.AlterField(
model_name='scraping',
name='prunings',
field=models.ManyToManyField(related_name='scrapings', to='home.pruning'),
),
]
2 changes: 1 addition & 1 deletion home/models/base_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class Crawling(TimeStampMixin):
class Scraping(TimeStampMixin):
nb_iterations = models.PositiveSmallIntegerField()
page = models.OneToOneField('Page', on_delete=models.CASCADE, related_name='scraping')
prunings = models.ManyToManyField('Pruning', related_name='new_scrapings')
prunings = models.ManyToManyField('Pruning', related_name='scrapings')


class Pruning(TimeStampMixin):
Expand Down
3 changes: 0 additions & 3 deletions scraping/services/scrape_page_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,9 @@ def upsert_scraping(page: Page, extracted_html: Optional[str]) -> ():
for extracted_html_item in extracted_html_list:
prunings.append(create_pruning(extracted_html_item))

legacy_pruning = prunings[0] if prunings else None # TODO remove this line

scraping = Scraping(
nb_iterations=1,
page=page,
pruning=legacy_pruning, # TODO remove this line
)
scraping.save()

Expand Down

0 comments on commit 29e8861

Please sign in to comment.