Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
lavamaze
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Will Billingsley
lavamaze
Commits
ad0c9b94
Commit
ad0c9b94
authored
6 years ago
by
Will Billingsley
Browse files
Options
Downloads
Patches
Plain Diff
Writes CSV of student logins
parent
70c93023
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/controllers/HomeController.scala
+26
-1
26 additions, 1 deletion
app/controllers/HomeController.scala
conf/routes
+3
-0
3 additions, 0 deletions
conf/routes
with
29 additions
and
1 deletion
app/controllers/HomeController.scala
+
26
−
1
View file @
ad0c9b94
package
controllers
import
java.lang.ProcessBuilder.Redirect
import
javax.inject._
import
play.api._
import
play.api.mvc._
...
...
@@ -11,6 +13,8 @@ import play.api.mvc._
@Singleton
class
HomeController
@Inject
()(
cc
:
ControllerComponents
)
extends
AbstractController
(
cc
)
{
/**
* Create an Action to render an HTML page.
*
...
...
@@ -19,6 +23,27 @@ class HomeController @Inject()(cc: ControllerComponents) extends AbstractControl
* a path of `/`.
*/
def
index
()
=
Action
{
implicit
request
:
Request
[
AnyContent
]
=>
Ok
(
views
.
html
.
index
())
Redirect
(
"assets/lavaclient/index.html"
)
}
val
csvFile
=
"logins.csv"
def
csv
=
Action
.
async
{
implicit
request
:
Request
[
AnyContent
]
=>
import
java.io._
import
scala.util.Try
import
scala.concurrent.Future
Future
.
fromTry
(
Try
{
val
fw
=
new
FileWriter
(
csvFile
,
true
)
fw
.
write
(
request
.
body
.
asText
+
"\n"
)
fw
.
flush
()
fw
.
close
()
Ok
(
""
)
})
}
}
This diff is collapsed.
Click to expand it.
conf/routes
+
3
−
0
View file @
ad0c9b94
...
...
@@ -8,6 +8,9 @@
GET /assets/*file controllers.Assets.at(path="/public", file)
GET /lavamaze/assets/*file controllers.Assets.at(path="/public", file)
POST /lavamaze/students controllers.HomeController.csv
POST /students controllers.HomeController.csv
GET / controllers.HomeController.index
GET /lavamaze controllers.HomeController.index
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment