Giter Site home page Giter Site logo

alexander-storozhenko / testlance-app Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 258 KB

server side of testlance-app android, ios, web

License: MIT License

Ruby 93.68% JavaScript 1.01% CoffeeScript 0.45% CSS 0.62% SCSS 1.15% HTML 1.68% Shell 0.32% Dockerfile 0.93% Lua 0.18%

testlance-app's Introduction

Readme

testlance-logo-title

Installation

  • gem install bundler
  • bundle install
  • rails db:create db:migrate
  • brew install [email protected] (macos)
  • sudo apt install mongodb (linux)
  • brew install redis-cli

Start

  • brew services start mongodb/brew/mongodb-community (macos)
  • mongod --fork --logpath /var/log/mongod.log (linux)
  • rails s
  • redis-server
  • sidekiq

(or bin/serv s)

Docker fast start (only linux)

  • docker-compose build && docker-compose up
  • docker-compose run app rails db:create db:migrate

Answer types

  • one,text
  • one,img
  • one,img-text
  • some,text
  • some,img
  • some,img-text
  • 1to1,text
  • 1to1,img
  • 1to1,img-text
  • 1toN,text
  • 1toN,img
  • 1toN,img-text

Answer formats

One, Some

[
  "answer 1 or img url", "[img url, answer text]",
  "answer 2 or img url", "[img url, answer text]",
  "answer 3 or img url", "[img url, answer text]"
]

1to1, 1toN

{
    "up": {
        "A": "<block 1 or img url, [img url, block text]>",
        "B": "<block 1 or img url, [img url, block text]>",
        "C": "<block 1 or img url, [img url, block text]>"
    },
    "down":{
        "0": "<answer 1 or img url, [img url, answer text]>",
        "1": "<answer 1 or img url, [img url, answer text]>",
        "2": "<answer 1 or img url, [img url, answer text]>"
    }
}

Lua scripts support

Reason

Default test has simple count of right answers (one error in 1toN will be 0). User can create own logic of results calculating.

Examples

Default alghorithm of question (type 'one answer')

in fact it counts inside ruby because of performance but I want to show principle of counting

local result = 0

for key, _ in pairs(USER_ANSWERS) do
    if TRUE_ANSWERS[key] == 'true' then
        result = 1
    end
end

return result

Limited question (user answer points will be decrease over time)

local result = 0

for key, _ in pairs(user_answers) do
    if true_answers[key] == 'true' then
        result = 1
    end
end

if compare_dates(DATE_NOW, '05/08/2021') == -1 then
    return result/2
else
    if compare_dates(DATE_NOW, '05/08/2021') == 1 then
        return result/3
    end
end

return result

In the future, it will be possible to create your own profile variables and use from instead of inline values

Examples was used global varibales (G_DATE_NOW, G_TRUE_ANSWERS, G_ALL_USER_ANSWERS) and helper functions (to_date). More about them in testlance-script


MIT license Copyright (c) 2021 Alexander Storozhenko

testlance-app's People

Contributors

alexander-storozhenko avatar

Watchers

 avatar

Forkers

kostrulnik

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.