app.engine.greengageStrategy module

# noqa https://dreampuf.github.io/GraphvizOnline/?compressed=CYSw5gTghgDgFgAgOIIN4CgFYdAdga1AgF4AVAIQG5NsatcB7YAUwQG0BnOWZ4gIwYAPADQIOAFwCeAG14AzENNnBRCpQGMG0hiWng44yFEkBdatgTNgYVmzkNc4jiABevAIwAGM3QSzJzLjAbNJQfMzSxABEALYAXAgAsiC4AK7izBwIADq4CAAiAAoJ%2BcxyUKnS4giFDClOOXkI5MXNDqlZtfVZjTUtCYXMEBwOUNJtaZ11jlm5BYWkAKIlZRVVNdMNpCAxrIuhMBxWvQDC%2BcQnDDEwsgBWIMBQwAXMAG4RDDC7jqeLF1c3Zj3R7PRaCG51cRQcQgBynRL-a53B5PJJQXBQGzfapzE6kRGA4Go0gMKHSKKqRTSTTaEgBJQMADukGYgRM6F8EigEGqITCEWiAGUoTyKWJuDBeBE9IdmJSNFodMQ9GADEZTOZsOo4Mx1PgQHJPOxQuFIrFiJ4oj4LNrdfq5AAZKASLqOADqzvcyVw5DKOmYfNN0VCEgQME2WQgzEZ3JYzwAFFCOPgAJQIAA8CHcCBiKStvlteo6Q24HCjmggwF99ijAElcKRnfhAwKogBVI4QBClnC6nTPcI11iJpsp-M2nV6g0AJnL-ayLbNxa73HeCAAfAhp72K8AOAB%2BBDxpBQXZj61ayf2g3bXa1jhIKPQoakbi4JDaPhjACCADUUIu0SCBuyCfmMCB-igx6nsw56alghbXnIt7MPej7MM%2BECvuigzDKM0iQca-JmsBm64SMGLjIR0Fnla8EIL4-iBMA06AVEJxjOolTQrCeS4viCBnAgADUgmLCJgmJL08wrAouDHCkYjiNAGRgJICAAFRHniAD0XieGmvRFEsCDEPMCAAOs5r0LSmfMJmifGxmLDp04pnMhS2WZzkSU5CwuQALGmYpqNSiokKQqQQAAjqkdRHOyHI2s6zDuAA%2BtmbEcUcWYAHTZn5Y6iFwPDEDA3JjLI2hGDE8phbSyr6FI0pMheCEpel25ZSleXbn5rlFeKpXldASgfDVdU0kqKoGPS2iMm1CDqClXUmq22WsH1RSWVug0lZKZUVWN1XQLVCChVNuhNXNrX0ctRwAMxEUG7E9U98YtHtEq8CNlXjadk3hY1qrNQyC13SlAUZc9609QF%2BVHp5hRfcNR1VQwE3nVSl3A7NLXgwWkNpatxHRBtCDw1t-kowdv3HRjANYwqDUzaD83Wkl2BcjyCAALSbohBqeAWV5C3zAtXsupZzpW1b%2BvWjbJjDZoAJqZOOl52lLzoy1Wfp1g2Tb80touOs64iuuIHocF6KRy1GyvRGrHAawhptOi6mzW7bPr68wxv3alxNsc7rtu3aBoexbXuet69v%2BwLHUZWxAByDBhyLWudtLfay37CtG4nRwky9adh4LhriybEdyLOud7o7URl%2ByE413Xu5ZAHK2N83mdTrXuudxLNc3jsqEPk%2BGRYW%2BH4MF%2BBH-o3oct5r-ej3eE8YVP2HvmBC8oF3j1L%2BrK-h2vyFj2hk8vjPe%2BEQHpvr%2BP6GYTv5H4YRqfp6f1fnyhV9bxvjhIYFEfyL0PswKGmU1qqxPn3JC-9N6vzfO-Si98i6QOJj3b%2BHIAC%2B6BcFAA

class app.engine.greengageStrategy.GREENGAGEGamificationStrategy[source]

Bases: BaseStrategy

get_DPTE(points, minutes=0)[source]

Returns the Default Points Time Elapsed (DPTE) based on the number of minutes elapsed, using the floor of the time range.

Parameters:

minutes (int) – The number of minutes elapsed.

Returns:

int – The Default Points Time Elapsed (DPTE).

get_BP(points=0, minutes=0)[source]

Returns the Bonus Points (BP) based on the number of minutes elapsed.

Parameters:
  • minutes (int) – The number of minutes elapsed.

  • points (int)

Returns:

int – The Bonus Points (BP).

get_PBP(points=0, minutes=0)[source]
Returns the Personal Bonus Points (PBP) based on the number of minutes

elapsed.

Parameters:
  • minutes (int) – The number of minutes elapsed.

  • points (int)

Returns:

int – The Personal Bonus Points (PBP).

generate_logic_graph(format='png')[source]

Render this strategy’s decision tree as a Graphviz diagram.

Builds a labelled flowchart (legend, decision nodes and the Case 1.1–4.2 outcomes) describing how minutes, records and global/personal averages map to a point award. Used by the dashboard to visualize the strategy.

Parameters:

format (str) – Graphviz output format (e.g. "png", "svg").

Returns:

graphviz.Digraph – The constructed diagram.

async calculate_points(externalGameId, externalTaskId, externalUserId, data)[source]

Award points from reported effort minutes and task complexity.

Requires a numeric minutes value in data. The award follows the Case 1.1–4.2 decision tree (see generate_logic_graph()), weighting the configured default points by total complexity and the user’s history/averages.

Parameters:
  • externalGameId – External identifier of the game.

  • externalTaskId – External identifier of the task.

  • externalUserId – External identifier of the user.

  • data (dict) – Event payload; must contain an integer minutes.

Returns:

tuple(points, caseName) on success, or (-1, message) when minutes is missing or invalid.