Skip to content

Commit ddf1389

Browse files
committed
fix settings
1 parent ce14c2d commit ddf1389

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

services/app/apps/codebattle/assets/js/widgets/config/languages.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export default {
1+
const languages = {
22
clojure: 'clojure',
33
cpp: 'cpp',
44
csharp: 'csharp',
@@ -20,4 +20,8 @@ export default {
2020
stylus: 'stylus',
2121
};
2222

23+
export const cssProcessors = ['css', 'less', 'sass', 'stylus'];
24+
2325
export const constructorLangauges = ['ruby'];
26+
27+
export default languages;

services/app/apps/codebattle/assets/js/widgets/pages/settings/UserSettingsForm.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ import {
66
Formik, Form, Field, useField,
77
} from 'formik';
88
import capitalize from 'lodash/capitalize';
9+
import omit from 'lodash/omit';
910
import * as Icon from 'react-feather';
1011
import * as Yup from 'yup';
1112

12-
import languages from '../../config/languages';
13+
import languages, { cssProcessors } from '../../config/languages';
1314
import schemas from '../../formik';
1415
import { createPlayer } from '../../lib/sound';
1516

16-
const playingLanguages = Object.entries(languages);
17+
const playingLanguages = Object.entries(omit(languages, cssProcessors));
1718

1819
const getPlaceholder = ({ disabled, placeholder }) => {
1920
if (!disabled) {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
defmodule Codebattle.Repo.Migrations.FixUserLang do
2+
use Ecto.Migration
3+
import Ecto.Query
4+
alias Codebattle.Repo
5+
alias Codebattle.User
6+
7+
def change do
8+
query = from(u in User, where: u.lang in ["css", "scss", "stylus", "less", "sass"])
9+
Repo.update_all(query, set: [lang: "js"])
10+
end
11+
end

0 commit comments

Comments
 (0)