Skip to content

url link for lesson sample data#1302

Open
sumandari wants to merge 3 commits into
kartoza:developfrom
sumandari:1291_neater_link_external_data
Open

url link for lesson sample data#1302
sumandari wants to merge 3 commits into
kartoza:developfrom
sumandari:1291_neater_link_external_data

Conversation

@sumandari
Copy link
Copy Markdown
Contributor

@sumandari sumandari commented Feb 17, 2021

This PR refers to #1291.
It provides neater link for download external_data file
/<project_slug>/sample/<worksheet id>?q=<module number>

The url cannot use module number as an argument (as mentioned in the ticket), since the module number is not retrieved from the model.
The pdf output name is using project and module number as the filename.

image
image

@sumandari sumandari self-assigned this Feb 17, 2021
@sumandari sumandari force-pushed the 1291_neater_link_external_data branch from c3f74e6 to 5d9a273 Compare February 17, 2021 10:51
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 17, 2021

Codecov Report

Merging #1302 (b624862) into develop (ede5c2f) will increase coverage by 0.02%.
The diff coverage is 84.61%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1302      +/-   ##
===========================================
+ Coverage    63.19%   63.21%   +0.02%     
===========================================
  Files          177      177              
  Lines         9338     9350      +12     
  Branches       706      707       +1     
===========================================
+ Hits          5901     5911      +10     
- Misses        3213     3214       +1     
- Partials       224      225       +1     
Impacted Files Coverage Δ
django_project/lesson/urls.py 86.66% <ø> (ø)
django_project/lesson/views/worksheet.py 74.21% <84.61%> (+0.39%) ⬆️

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 ede5c2f...b624862. Read the comment docs.

"""Download sample data."""

def get(self, request, *args, **kwargs):
numbering = self.request.GET.get('q', '')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can you get this version number from the project model? so you don't need to pass this variable to view because it seems redundant.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The numbering is not saved in the model instance.
It's coming from dynamic forloop in the template.

<a href="{% url "worksheet-detail" project_slug=worksheet.section.project.slug section_slug=worksheet.section.slug pk=worksheet.pk %}?q={{ forloop.parentloop.counter|add:page_obj.start_index|add:'-1' }}.{{ forloop.counter }}">

and the numbering might be different between author and normal user, since the author have view in draft (unpublished) worksheet, but the normal users don't.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

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.

3 participants