8000 Card Loading API by RaitoBezarius · Pull Request #353 · mangaki/mangaki · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Card Loading API #353

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

Merged
merged 7 commits into from
Jul 17, 2017
Merged

Card Loading API #353

merged 7 commits into from
Jul 17, 2017

Conversation

RaitoBezarius
Copy link
Member
@RaitoBezarius RaitoBezarius commented Jun 23, 2017

Fixes partially #130 (a plan is explained over there).

I think we should get rid of JSReverse in another PR which will clean out the JavaScript to use the public API.

@codecov
Copy link
codecov bot commented Jun 23, 2017

Codecov Report

Merging #353 into master will increase coverage by 1.69%.
The diff coverage is 90.62%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #353      +/-   ##
=========================================
+ Coverage    52.1%   53.8%   +1.69%     
=========================================
  Files          61      72      +11     
  Lines        3568    4130     +562     
=========================================
+ Hits         1859    2222     +363     
- Misses       1709    1908     +199
Impacted Files Coverage Δ
mangaki/mangaki/settings.py 78.78% <100%> (+8.9%) ⬆️
mangaki/mangaki/api/urls.py 100% <100%> (ø)
mangaki/mangaki/urls.py 100% <100%> (ø) ⬆️
mangaki/mangaki/templates/mangaki/work_rating.html 64.58% <100%> (ø)
mangaki/mangaki/views.py 48.02% <20%> (-5.98%) ⬇️
mangaki/mangaki/api/cards.py 96% <96%> (ø)
mangaki/mangaki/utils/anidb.py 56.81% <0%> (-36.29%) ⬇️
mangaki/mangaki/mixins.py 72.22% <0%> (-11.12%) ⬇️
mangaki/mangaki/models.py 82.62% <0%> (-7.53%) ⬇️
... and 31 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 00ae19e...e7846d2. Read the comment docs.

@RaitoBezarius RaitoBezarius mentioned this pull request Jun 25, 2017
6 tasks
@RaitoBezarius RaitoBezarius changed the title WIP: Minimal Public API WIP: Card Loading API Jun 25, 2017
@@ -149,13 +150,22 @@
LOGIN_URL = '/user/login/'
LOGIN_REDIRECT_URL = '/'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_SIGNUP_FORM_CLASS= 'mangaki.forms.SignupForm'
ACCOUNT_SIGNUP_FORM_CLASS = 'mangaki.forms.SignupForm'
Copy link
Member Author

Choose a reason for hiding this comment

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

sorry, my OCD is incurable.


class SlotCardTypes(enum.Enum):
popularity = 'popular'
controversy = 'controversial'
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we have different values than the name?

Copy link
Member Author

Choose a reason for hiding this comment

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

At the start, I wanted to have something like: queryset[SlotCardTypes.popularity]()

But, due to DPP and random special treatment, that does not sound possible.

As a relic of the past, I kept the mapping. Shouldn't we uniformize them to match the queryset methods?

@@ -210,6 +210,10 @@ Slot.prototype.fetch = function () {
/* Mosaic takes care of mapping Cards inside an element with Slots pointing to
* some remote URLs on the server.
*/
function buildSlotURL(category, slot_sort) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you keep the documentation for the Mosaic function close to the Mosaic function?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure.

@@ -317,8 +272,8 @@ def get_context_data(self, **kwargs):

if sort_mode == 'mosaic' and not self.is_dpp:
context['object_list'] = [
Work(title='Chargement…', ext_poster='/static/img/chiro.gif')
for _ in range(4)
(slot_sort_type, Work(title='Chargement…', ext_poster='/static/img/chiro.gif'))
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use {'sort_type': slot_sort_type, 'work': Work(title=...)} instead? Would make the template code more readable. BTW we should do {'work': Work(...)} for the other cases as well for consistency; that way we can easily get rid of works_mosaic.html.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea.

@@ -0,0 +1,13 @@
<div class="row">
<div class="col-xs-12 cards-grid">
{% for slot_and_work in works %}
Copy link
Contributor

Choose a reason for hiding this comment

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

If we get rid of the tuple we can just do {% for work_meta in works %} in works.html then pass the work=work_meta.work slot_type=work_meta.slot_type in the {% include %} below. I believe Django uses None as the default for missing keys.

@RaitoBezarius RaitoBezarius changed the title WIP: Card Loading API Card Loading API Jun 26, 2017
this.slots = els.map(function (el, index) {
return new Slot('/data/card/' + category + '/' + (index + 1) + '.json');
this.slots = els.map(function (el) {
return new Slot(buildSlotURL(category, $(el).data('slot-sort')));
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use attr('data-slot-sort')

Copy link
Contributor

Choose a reason for hiding this comment

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

el.getAttribute('data-slot-sort')

@RaitoBezarius RaitoBezarius merged commit d292fbf into master Jul 17, 2017
@RaitoBezarius RaitoBezarius deleted the raito/api branch July 17, 2017 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0