Skip to content
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

feature-8683: Add Options for Badges in Wizard #8968

Merged
merged 48 commits into from Jul 20, 2023
Merged

feature-8683: Add Options for Badges in Wizard #8968

merged 48 commits into from Jul 20, 2023

Conversation

ghost
Copy link

@ghost ghost commented Jul 10, 2023

Fixes:

Short description of what this resolves:

  • Add Options for Badges in Wizard
  • API to return list of badge fields to print
  • Return a PDF for badge printing from server

Changes proposed in this pull request:

  • Add Options for Badges in Wizard
  • API to return list of badge fields to print
  • Return a PDF for badge printing from server

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.

@auto-label auto-label bot added the feature label Jul 10, 2023
lthanhhieu and others added 28 commits July 10, 2023 17:58
Merge pull request #4 from khangon/khangon_tma/feature-8683
feature-8683: Add Options for Badges in Wizard
@ghost ghost marked this pull request as ready for review July 18, 2023 10:34
@ghost
Copy link
Author

ghost commented Jul 19, 2023

Hi @cweitat , @mariobehling , @norbusan
Please help me review the PR.

@cweitat
Copy link
Contributor

cweitat commented Jul 19, 2023

@lthanhhieu do update the api documentation

@mariobehling
Copy link
Member

@lthanhhieu Please solve pytype error.

/root/code/venv/bin/python3 -m pytype.single --disable pyi-error --imports_info /root/code/.pytype/imports/app.api.helpers.badge_forms.imports --module-name app.api.helpers.badge_forms -V 3.9 -o /root/code/.pytype/pyi/app/api/helpers/badge_forms.pyi --analyze-annotated --nofail --quick /root/code/app/api/helpers/badge_forms.py
File "/root/code/app/api/helpers/badge_forms.py", line 51, in get_value_from_field_indentifier: unsupported operand type(s) for item retrieval: str and str [unsupported-operands]
  Function __getitem__ on str expects Union[int, slice]```
For more details, see https://google.github.io/pytype/errors.html#unsupported-operands

@mariobehling
Copy link
Member

Thanks, please also check dredd tests. Looks like there is an issue with the PDF.
https://app.circleci.com/pipelines/github/fossasia/open-event-server/6588/workflows/43e83c2c-3d01-40e9-a46c-8e9c77d2d853/jobs/24449

info: Hooks handler stderr: Connection closed, could not parse JSON

info: Displaying failed tests...
fail: GET (200) /v1/tickets/1/badge-forms duration: 78ms
fail: headers: Header 'content-type' has value 'application/vnd.api+json' instead of 'application/json'```

```expected: 
headers: 
    Content-Type: application/pdf

body: 
File PDF

statusCode: 200


actual: 
statusCode: 500
headers: 
    content-type: text/html; charset=utf-8
    content-length: 290
    server: Werkzeug/2.0.3 Python/3.9.17
    date: Wed, 19 Jul 2023 16:09:08 GMT```

)


@badge_forms_routes.route('/preivew-badge-pdf', methods=['POST'])
Copy link
Member

Choose a reason for hiding this comment

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

Should be preview-badge-pdf not preivew

Copy link
Author

Choose a reason for hiding this comment

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

Thanks you. I fixed it

@ghost
Copy link
Author

ghost commented Jul 20, 2023

@lthanhhieu do update the api documentation

API for #8982

Get list of badge fields to print [/v1/tickets/int:ticket_id/badge-forms]

Get list of badge fields to print [GET]

Get the list of badge fields to print using JWT token

  • Request

    • Headers

        Accept: application/json
      
        Authorization: JWT <Auth Key>
      
  • Response 200 (application/json)

      [
          {
              "custom_field": "Email",
              "field_identifier": "email",
              "id": 8200
          },
          {
              "custom_field": "Are you fluent in any other of the following languages?",
              "field_identifier": "fluent_language",
              "id": 8202
          },
          {
              "custom_field": "Age Group",
              "field_identifier": "ageGroup",
              "id": 8201
          }
      ]
    

API for #8955

Return a PDF for badge printing from server [/v1/badge-forms/print-badge-pdf]

Return a PDF for badge printing from server [POST]

Return a PDF for badge printing from server using JWT token

  • Request

    • Headers

        Accept: application/json
      
        Authorization: JWT <Auth Key>
      
    • Body

        {
          "attendee_id": 1,
          "list_field_show" : ["email", "fluent_language"]
        }
      
  • Response 200 (application/pdf)

    • Return File PDF

@mariobehling
Copy link
Member

As discussed privately off-site I am merging this for functional testing. Thanks.

@mariobehling mariobehling merged commit d7f9453 into fossasia:development Jul 20, 2023
2 checks passed
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.

5 participants