first commit
way too late.
This commit is contained in:
commit
d4f7dc57fc
53 files changed
+3518
No files matched your search
@@ -0,0 +1,30 @@
|
||||
define ["app"], (app) ->
|
||||
app.controller "DoormanCtrl", ["$scope", "$http","$routeParams","$location", ($scope, $http, $routeParams, $location) ->
|
||||
$scope.doorman = {values: []}
|
||||
$scope.apiurl = "/api/doormen/#{$routeParams.id}"
|
||||
$http.get($scope.apiurl).then((res) ->
|
||||
$scope.doorman = res.data
|
||||
).catch((res) ->
|
||||
if res.status == 404
|
||||
$location.path("/doormen/error/#{res.status}/#{$routeParams.id}")
|
||||
)
|
||||
|
||||
$scope.deleteDoorman = () ->
|
||||
console.log("not yet implemented")
|
||||
|
||||
$scope.validate = ()->
|
||||
ret = 0
|
||||
for val in $scope.doorman.values
|
||||
ret += val.probability
|
||||
return Math.abs(ret - 1.0) < 0.000001
|
||||
|
||||
$scope.updateDoorman = () ->
|
||||
if !$scope.validate()
|
||||
return
|
||||
$http.put($scope.apiurl, $scope.doorman).then((ret)->
|
||||
console.log "update"
|
||||
).catch((res) ->
|
||||
d = 9
|
||||
)
|
||||
]
|
||||
return
|
||||
Reference in new issue
Block a user