I was not offended personally, however I was annoyed that a conversation on a topic that I felt helpful to the community was being shut down.

When I shared the response I got the feedback was that the received answer fell under was the umbrella of "mansplainining" and how a response such as that is problematic and explained why folks are turned off to tech, it certainly factors into my weariness with engaging with various communities out there.


It's not that I have any doubt of my skills, but that in the way they were called out was problematic because it shifted the topic from solving a problem to a question about the skillset of the person presenting the problem. That was the cause of irritation.

The only offense taken was that my time was wasted and that further research into the problem was being brushed aside by questioning skill rather than looking into the actual problem presented.

Anyhow, I found something useful, and I will be looking at making it more generally useful and hopefully sharing with the community.

Adding a snippet like this to my app was very helpful, however I'm wondering if there's something I'm missing that may cause a catastrophe?

I'm looking at maybe making it useful for detecting if a new piece of code happens to also cause more then "N" queries to suddenly happen, making the app slow.

Is there maybe a better way?

thanks,

-Alfred


+++ b/jetbridge/models/quiz_attempt.py
@@ -84,12 +84,21 @@ class QuizAttempt(JBModel, db.Model):
             query = query.options(jl)
         return query

+ def new_score_before_cursor_execute(self, conn, cursor, statement, parameters, context, executemany):
+        log.info("quiz_attempt id: {} ".format(self.id))
+ log.info("vvvvvvvvvvvvvvvvvvv\nNEW_SCORE: Received statement: %s\n^^^^^^^^^^^^^^^^^^\n", statement)
+
+
     def new_score(self, question_id=None, question=None):
         """The new scoring system.

         Returns a triple (total_score, base_score, timer_bonus)
         """
         _log_scores("Called new_score")
+        from sqlalchemy import event
+        listen_obj = db.session.connection()
+        fun = self.new_score_before_cursor_execute
+        event.listen(listen_obj, "before_cursor_execute", fun)

         table = dict()
         """
@@ -143,6 +152,7 @@ class QuizAttempt(JBModel, db.Model):
         log.debug("loops = {}".format(loops))
log.debug("score: {} (base: {}, timer_bonus: {})".format(total_score, base_score, timer_bonus))
         """
+        event.remove(listen_obj, "before_cursor_execute", fun)
         return {
             "score_total": total_score,
             "score_base": base_score,



On 10/17/16 10:34 AM, Jonathan Vanasco wrote:
Alfred-

I'm sorry you felt offended and misinterpreted my comment. I did not think you were unskilled in the slightest. Quite the opposite (i did look you up).

Your concerns and solutions were in-line with to how every highly experienced lower-level engineer I've worked with has approached an issue in a Python app. I was hoping to spark a positive discussion, not offend you.
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to a topic in the Google Groups "sqlalchemy" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/sqlalchemy/W2c5LmCcnww/unsubscribe. To unsubscribe from this group and all its topics, send an email to sqlalchemy+unsubscr...@googlegroups.com <mailto:sqlalchemy+unsubscr...@googlegroups.com>. To post to this group, send email to sqlalchemy@googlegroups.com <mailto:sqlalchemy@googlegroups.com>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

--
SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to