PyZombis icon indicating copy to clipboard operation
PyZombis copied to clipboard

Refactor Lecture TWP42: Bases de datos (indexedDB approach)

Open AngelaRemolina opened this issue 4 years ago • 3 comments

Summary

This PR may close: https://github.com/angelasofiaremolinagutierrez/PyZombis/issues/48 I have implemented an approach to solve this issue of lecture TWP 42: Bases de datos with an API that is supported by Brython called indexedDB.

Important note: The refactoring is not finished, this is just a test. Even though this is a functional solution, the syntax changes a lot from the original lecture where sqlite3 was used.

For example:

cursor.execute("select * from surfers  where age > 25")
linhas = cursor.fetchall()
for linha in linhas:
    print("id :",linha['id'])
    print("Nombre :",linha['name'])
    print("Pais  :",linha['country'])
    print("Media  :",linha['average'])
    print("Estilo :",linha['board'])
    print("Edad  :",linha['age'])
    print()

had to change to:

if(getattr(v, "edad") >=25):
    for key in ["nombre", "pais", "media", "estilo", "edad"]:
        print(f"{key}: {getattr(v, key)}")
  getattr(res, "continue")()

I will keep exploring other possible options, but this is a starting point in case none other option is found.

Checklist

  • [x] Variables, functions and comments are translated to Spanish
  • [x] Functions follow underscore notation
  • [x] Spell check done & typos fixed
  • [x] All python code is PEP8 compliant
  • [x] Test coverage with Playwright implemented; locators are Pyhton code
  • [x] Reviewers assigned (all peers & at least 1 mentor)

Screenshots

indexedDB

AngelaRemolina avatar Aug 09 '21 05:08 AngelaRemolina

Published to http://pyar.github.io/PyZombis/171/index.html

github-actions[bot] avatar Aug 09 '21 05:08 github-actions[bot]

Published to http://pyar.github.io/PyZombis/171/index.html

github-actions[bot] avatar Aug 09 '21 05:08 github-actions[bot]

Published to http://pyar.github.io/PyZombis/171/index.html

github-actions[bot] avatar Aug 09 '21 05:08 github-actions[bot]