Skip to content

Conversation

@YogeshSharma0201
Copy link
Contributor

Fixes #4613, #5513

Checklist

  • I have read the Contribution & Best practices Guide and my PR follows them.
  • My branch is up-to-date with the Upstream development branch.
  • The unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • All the functions created/modified in this PR contain relevant docstrings.

Short description of what this resolves:

Import Event api is working now and through /import-jobs api Import jobs list can be retrieved and displayed on frontend.

Changes proposed in this pull request:

  • Event Model is fixed so that it accepts event_orga_id
  • Import Jobs schema and api added.
  • Added apiblueprint for import jobs api
  • Import Jobs relationship are not added in the schema as it was not necessary for this PR, Let me know if that is required too.

@codecov
Copy link

codecov bot commented Jan 10, 2019

Codecov Report

Merging #5514 into development will increase coverage by 1.12%.
The diff coverage is 82.22%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #5514      +/-   ##
===============================================
+ Coverage        65.57%   66.69%   +1.12%     
===============================================
  Files              277      286       +9     
  Lines            13439    13876     +437     
===============================================
+ Hits              8812     9255     +443     
+ Misses            4627     4621       -6
Impacted Files Coverage Δ
app/api/imports.py 34.61% <0%> (ø) ⬆️
app/api/schema/import_jobs.py 100% <100%> (ø)
app/api/__init__.py 100% <100%> (ø) ⬆️
app/models/event.py 81.49% <100%> (+0.37%) ⬆️
app/api/helpers/import_helpers.py 27.38% <50%> (+9.42%) ⬆️
app/api/import_jobs.py 83.33% <83.33%> (ø)
app/models/setting.py 90.07% <0%> (-2.73%) ⬇️
tests/all/unit/api/helpers/test_storage.py 97.29% <0%> (-2.71%) ⬇️
app/api/users.py 33.55% <0%> (-1.17%) ⬇️
app/api/helpers/payment.py 25.3% <0%> (-0.95%) ⬇️
... and 37 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 be60472...311e585. Read the comment docs.

Copy link
Contributor

@abhinavk96 abhinavk96 left a comment

Choose a reason for hiding this comment

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

Resolve the codacy issues please

@YogeshSharma0201
Copy link
Contributor Author

@CosmicCoder96 do you think these codacy issues need to be fixed? i cannot change variable name 'id' and no methods are currently required in impor_job schema.

Copy link
Member

@iamareebjamal iamareebjamal left a comment

Choose a reason for hiding this comment

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

URL issues

@abhinavk96
Copy link
Contributor

@YogeshSharma0201 update this please

@fossasia fossasia deleted a comment Mar 26, 2019
@fossasia fossasia deleted a comment Mar 26, 2019
@fossasia fossasia deleted a comment Mar 26, 2019
@fossasia fossasia deleted a comment Mar 26, 2019
@fossasia fossasia deleted a comment Mar 26, 2019
@fossasia fossasia deleted a comment Mar 26, 2019
@YogeshSharma0201
Copy link
Contributor Author

@CosmicCoder96 please review

path + '/social_links',
json.dumps(data.get('social_links', []))
) # save social_links
with open(path + '/social_links', 'w') as file:
Copy link
Contributor

Choose a reason for hiding this comment

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

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@CosmicCoder96 i can't use write_file() because it tries to encode the data in utf-8 which gives errors.

Copy link
Member

Choose a reason for hiding this comment

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

What errors?

Copy link
Contributor Author

@YogeshSharma0201 YogeshSharma0201 Apr 8, 2019

Choose a reason for hiding this comment

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

@iamareebjamal error: decoding str is not supported

@abhinavk96
Copy link
Contributor

@YogeshSharma0201 updates?

@YogeshSharma0201 YogeshSharma0201 force-pushed the fix_event_import branch 2 times, most recently from cc7eb99 to 30f97aa Compare April 8, 2019 08:53
@YogeshSharma0201
Copy link
Contributor Author

@CosmicCoder96 please review

@abhinavk96
Copy link
Contributor

@iamareebjamal Can you help out with the error mentioned by @YogeshSharma0201. What could be a possible solution?

@iamareebjamal
Copy link
Member

write_file takes bytes as argument and json.dumps returns string.

Add .encode('utf-8') after json.dumps call

json.dumps(data.get(..., [])).encode('utf-8')

@abhinavk96
Copy link
Contributor

@YogeshSharma0201 Please update this now with the fix mentioned by @iamareebjamal

json.dumps(data.get('social_links', []))
) # save social_links
json.dumps(data.get('social_links', [])).encode('utf-8')
) # save social_links

Choose a reason for hiding this comment

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

at least two spaces before inline comment

@iamareebjamal iamareebjamal changed the title Fix event import fix: event import May 14, 2019
@auto-label auto-label bot added the fix label May 14, 2019
@iamareebjamal iamareebjamal merged commit e942a88 into fossasia:development May 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Event import end point not working

4 participants