-
Notifications
You must be signed in to change notification settings - Fork 5
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
SQL #158
base: master
Are you sure you want to change the base?
SQL #158
Conversation
plase update tests/test_*.nit |
.gitignore
Outdated
@@ -3,7 +3,6 @@ bin/ | |||
*.orig | |||
db_loader_serial.nit | |||
out/ | |||
db/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we still need to ignore the directory I think
.gitignore
Outdated
@@ -3,7 +3,6 @@ bin/ | |||
*.orig | |||
db_loader_serial.nit | |||
out/ | |||
db/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we still need to ignore the db generated files
the PR is huge. If you do not plan to split it, could you explain what you did exactly? |
45 files changed, 3 commits... seriously? |
![1dan1m](https://cloud.githubusercontent.com/assets/1444825/19865386/650afce4-9f72-11e6-8e49-5152e7f5f2ed.jpg) Big PR here, this should make the transition from a MongoDB model to the famed SQL model. The code base being large, there might be some parts of the application that might break, but from the last checks I did, most of the app should work. Some parts, like achievements may need a bit of an overhaul to make it production-ready, but the base is here. Note: I know the login redirect is semi-broken, I'll check to fix it, in the meantime, you are more than encouraged to take a look at the code :) <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/morriar/missions/158) <!-- Reviewable:end --> Pull-Request: #158 Reviewed-by: Jean Privat <jean@pryen.org> Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
TODO:
|
Done |
![1dan1m](https://cloud.githubusercontent.com/assets/1444825/19865386/650afce4-9f72-11e6-8e49-5152e7f5f2ed.jpg) Big PR here, this should make the transition from a MongoDB model to the famed SQL model. The code base being large, there might be some parts of the application that might break, but from the last checks I did, most of the app should work. Some parts, like achievements may need a bit of an overhaul to make it production-ready, but the base is here. Note: I know the login redirect is semi-broken, I'll check to fix it, in the meantime, you are more than encouraged to take a look at the code :) <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/morriar/missions/158) <!-- Reviewable:end --> Pull-Request: #158 Reviewed-by: Jean Privat <jean@pryen.org> Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Dockerfile
Outdated
@@ -1,7 +1,7 @@ | |||
FROM nitlang/nit | |||
|
|||
# Needed for nitcorn and to build mongo-c-driver | |||
RUN apt-get update && apt-get install -y libevent-dev libssl-dev libsasl2-dev libcurl4-openssl-dev file | |||
RUN apt-get update && apt-get install -y libevent-dev libssl-dev libsasl2-dev libcurl4-openssl-dev file libsqlite3-dev | |||
|
|||
# Install mongo-c-driver manually since it is not available in Debian/jessie | |||
RUN curl -L https://github.com/mongodb/mongo-c-driver/releases/download/1.4.0/mongo-c-driver-1.4.0.tar.gz -o mongo-c-driver-1.4.0.tar.gz \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mongo-c-driver is no longer required if sqlite is used .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should not be, but there seems to be some import somewhere at the moment which prevents us from compiling when mongoc
is unavailable, so we left it for now
![1dan1m](https://cloud.githubusercontent.com/assets/1444825/19865386/650afce4-9f72-11e6-8e49-5152e7f5f2ed.jpg) Big PR here, this should make the transition from a MongoDB model to the famed SQL model. The code base being large, there might be some parts of the application that might break, but from the last checks I did, most of the app should work. Some parts, like achievements may need a bit of an overhaul to make it production-ready, but the base is here. Note: I know the login redirect is semi-broken, I'll check to fix it, in the meantime, you are more than encouraged to take a look at the code :) <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/morriar/missions/158) <!-- Reviewable:end --> Pull-Request: #158 Reviewed-by: Jean Privat <jean@pryen.org> Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org> Reviewed-by: Istvan SZALAÏ <istvan.szalai@savoirfairelinux.com>
OK, for the explanation of what is happening here, the new model is articulated around a few things:
This should sum-up the differences, if there are any questions left, feel free to ask. |
![1dan1m](https://cloud.githubusercontent.com/assets/1444825/19865386/650afce4-9f72-11e6-8e49-5152e7f5f2ed.jpg) Big PR here, this should make the transition from a MongoDB model to the famed SQL model. The code base being large, there might be some parts of the application that might break, but from the last checks I did, most of the app should work. Some parts, like achievements may need a bit of an overhaul to make it production-ready, but the base is here. Note: I know the login redirect is semi-broken, I'll check to fix it, in the meantime, you are more than encouraged to take a look at the code :) <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/morriar/missions/158) <!-- Reviewable:end --> Pull-Request: #158 Reviewed-by: Jean Privat <jean@pryen.org> Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org> Reviewed-by: Istvan SZALAÏ <istvan.szalai@savoirfairelinux.com>
![1dan1m](https://cloud.githubusercontent.com/assets/1444825/19865386/650afce4-9f72-11e6-8e49-5152e7f5f2ed.jpg) Big PR here, this should make the transition from a MongoDB model to the famed SQL model. The code base being large, there might be some parts of the application that might break, but from the last checks I did, most of the app should work. Some parts, like achievements may need a bit of an overhaul to make it production-ready, but the base is here. Note: I know the login redirect is semi-broken, I'll check to fix it, in the meantime, you are more than encouraged to take a look at the code :) <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/morriar/missions/158) <!-- Reviewable:end --> Pull-Request: #158 Reviewed-by: Jean Privat <jean@pryen.org> Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org> Reviewed-by: Istvan SZALAÏ <istvan.szalai@savoirfairelinux.com>
src/api/api_auth_shibuqam.nit
Outdated
@@ -127,7 +126,7 @@ class ShUser | |||
serialize | |||
|
|||
# The *code permanent* (or the uid for non student) | |||
var id: String | |||
var slug: String |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bad
src/api/api_auth.nit
Outdated
@@ -115,10 +115,15 @@ abstract class AuthLogin | |||
# Register a new player and add a first-login achievement | |||
# | |||
# Helper method to use when a new account is created. | |||
fun register_new_player(player: Player) | |||
fun register_new_player(ctx: DBContext, player: Player) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use the ctx of the player
src/api/api_base.nit
Outdated
@@ -30,6 +30,10 @@ class APIRouter | |||
var config: AppConfig | |||
end | |||
|
|||
redef class HttpRequest | |||
var ctx: DBContext is lazy do return new DBContext |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doc
src/model/submissions.nit
Outdated
|
||
var old_score = self.old_score | ||
if old_score != null then | ||
res += " (was {old_score})" | ||
end | ||
return res | ||
end | ||
|
||
redef fun insert do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
factorize the insert/update/whatever with the "template method" design pattern™ by extracting the query part
tests/test_nitc.nit
Outdated
# Create a dummy user | ||
var player = new Player("John", "Doe") | ||
config.players.save player | ||
with ctx = new DBContext do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a with
? Ohhhhhh
@@ -38,6 +38,6 @@ <h1 class='pull-right'> | |||
</div> | |||
</div> | |||
<mission-submit mission='missionCtrl.mission' mission-status='missionCtrl.missionStatus' | |||
ng-if='missionCtrl.playerId' /> | |||
ng-if='missionCtrl.playerId && missionCtrl.missionStatus.status != "locked"' /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:( see #29
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll add some debug/god mode someday for this.
@@ -4,9 +4,6 @@ | |||
</div> | |||
<div class='card-body'> | |||
<h5>{{notification.object}}</h5> | |||
<p class='text-muted'> | |||
{{notification.timestamp * 1000 | date: 'dd, MMM, yyyy HH:MM:ss a'}} | |||
</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
src/model/missions.nit
Outdated
var solve_reward: Int = 0 is writable, serialize_as("reward") | ||
var path: String = "" is writable | ||
# Template for the source code | ||
var template: nullable String = null is writable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add template
in the DB
mission tree is broken |
![1dan1m](https://cloud.githubusercontent.com/assets/1444825/19865386/650afce4-9f72-11e6-8e49-5152e7f5f2ed.jpg) Big PR here, this should make the transition from a MongoDB model to the famed SQL model. The code base being large, there might be some parts of the application that might break, but from the last checks I did, most of the app should work. Some parts, like achievements may need a bit of an overhaul to make it production-ready, but the base is here. Note: I know the login redirect is semi-broken, I'll check to fix it, in the meantime, you are more than encouraged to take a look at the code :) <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/morriar/missions/158) <!-- Reviewable:end --> Pull-Request: #158 Reviewed-by: Jean Privat <jean@pryen.org> Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org> Reviewed-by: Istvan SZALAÏ <istvan.szalai@savoirfairelinux.com>
![1dan1m](https://cloud.githubusercontent.com/assets/1444825/19865386/650afce4-9f72-11e6-8e49-5152e7f5f2ed.jpg) Big PR here, this should make the transition from a MongoDB model to the famed SQL model. The code base being large, there might be some parts of the application that might break, but from the last checks I did, most of the app should work. Some parts, like achievements may need a bit of an overhaul to make it production-ready, but the base is here. Note: I know the login redirect is semi-broken, I'll check to fix it, in the meantime, you are more than encouraged to take a look at the code :) <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/morriar/missions/158) <!-- Reviewable:end --> Pull-Request: #158 Reviewed-by: Jean Privat <jean@pryen.org> Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org> Reviewed-by: Istvan SZALAÏ <istvan.szalai@savoirfairelinux.com>
+1 |
@R4PaSs: I would definitely expect some benchmarks explaining why we have to endure this 1500 lines addon :) |
tests/test_nitc.nit
Outdated
@@ -13,52 +13,56 @@ var opts = new AppOptions.from_args(args) | |||
var config = new AppConfig.from_options(opts) | |||
|
|||
# clean bd | |||
config.db.drop | |||
#config.db.drop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just delete it(c)
tests/test_nitc.nit
Outdated
|
||
# Load nit | ||
config.load_track("tracks/nit") | ||
#config.load_track("tracks/nit") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just delete it(c)
![1dan1m](https://cloud.githubusercontent.com/assets/1444825/19865386/650afce4-9f72-11e6-8e49-5152e7f5f2ed.jpg) Big PR here, this should make the transition from a MongoDB model to the famed SQL model. The code base being large, there might be some parts of the application that might break, but from the last checks I did, most of the app should work. Some parts, like achievements may need a bit of an overhaul to make it production-ready, but the base is here. Note: I know the login redirect is semi-broken, I'll check to fix it, in the meantime, you are more than encouraged to take a look at the code :) <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/morriar/missions/158) <!-- Reviewable:end --> Pull-Request: #158 Reviewed-by: Jean Privat <jean@pryen.org> Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org> Reviewed-by: Istvan SZALAÏ <istvan.szalai@savoirfairelinux.com>
![1dan1m](https://cloud.githubusercontent.com/assets/1444825/19865386/650afce4-9f72-11e6-8e49-5152e7f5f2ed.jpg) Big PR here, this should make the transition from a MongoDB model to the famed SQL model. The code base being large, there might be some parts of the application that might break, but from the last checks I did, most of the app should work. Some parts, like achievements may need a bit of an overhaul to make it production-ready, but the base is here. Note: I know the login redirect is semi-broken, I'll check to fix it, in the meantime, you are more than encouraged to take a look at the code :) <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/morriar/missions/158) <!-- Reviewable:end --> Pull-Request: #158 Reviewed-by: Jean Privat <jean@pryen.org> Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org> Reviewed-by: Istvan SZALAÏ <istvan.szalai@savoirfairelinux.com>
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Signed-off-by: Philippe Pepos Petitclerc <ppeposp@gmail.com>
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
05115cf
to
39d1390
Compare
![1dan1m](https://cloud.githubusercontent.com/assets/1444825/19865386/650afce4-9f72-11e6-8e49-5152e7f5f2ed.jpg) Big PR here, this should make the transition from a MongoDB model to the famed SQL model. The code base being large, there might be some parts of the application that might break, but from the last checks I did, most of the app should work. Some parts, like achievements may need a bit of an overhaul to make it production-ready, but the base is here. Note: I know the login redirect is semi-broken, I'll check to fix it, in the meantime, you are more than encouraged to take a look at the code :) <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/morriar/missions/158) <!-- Reviewable:end --> Pull-Request: #158 Reviewed-by: Jean Privat <jean@pryen.org> Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org> Reviewed-by: Istvan SZALAÏ <istvan.szalai@savoirfairelinux.com>
![1dan1m](https://cloud.githubusercontent.com/assets/1444825/19865386/650afce4-9f72-11e6-8e49-5152e7f5f2ed.jpg) Big PR here, this should make the transition from a MongoDB model to the famed SQL model. The code base being large, there might be some parts of the application that might break, but from the last checks I did, most of the app should work. Some parts, like achievements may need a bit of an overhaul to make it production-ready, but the base is here. Note: I know the login redirect is semi-broken, I'll check to fix it, in the meantime, you are more than encouraged to take a look at the code :) <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/morriar/missions/158) <!-- Reviewable:end --> Pull-Request: #158 Reviewed-by: Jean Privat <jean@pryen.org> Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org> Reviewed-by: Istvan SZALAÏ <istvan.szalai@savoirfairelinux.com>
![1dan1m](https://cloud.githubusercontent.com/assets/1444825/19865386/650afce4-9f72-11e6-8e49-5152e7f5f2ed.jpg) Big PR here, this should make the transition from a MongoDB model to the famed SQL model. The code base being large, there might be some parts of the application that might break, but from the last checks I did, most of the app should work. Some parts, like achievements may need a bit of an overhaul to make it production-ready, but the base is here. Note: I know the login redirect is semi-broken, I'll check to fix it, in the meantime, you are more than encouraged to take a look at the code :) <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/morriar/missions/158) <!-- Reviewable:end --> Pull-Request: #158 Reviewed-by: Jean Privat <jean@pryen.org> Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org> Reviewed-by: Istvan SZALAÏ <istvan.szalai@savoirfairelinux.com>
Big PR here, this should make the transition from a MongoDB model to the famed SQL model.
The code base being large, there might be some parts of the application that might break, but from the last checks I did, most of the app should work.
Some parts, like achievements may need a bit of an overhaul to make it production-ready, but the base is here.
Note: I know the login redirect is semi-broken, I'll check to fix it, in the meantime, you are more than encouraged to take a look at the code :)
This change is