Skip to content

Commit 7f1dde8

Browse files
author
Daniil.Karol
committed
Remove unused task files and enhance theme handling
Deleted obsolete example tasks and replaced them with more structured, practical coding tasks. Improved theme configuration by adding support for the 'Dark' theme and ensuring better compatibility with UI updates. Some deprecated code sections were commented for future refactoring.
1 parent 324b829 commit 7f1dde8

File tree

17 files changed

+164
-155
lines changed

17 files changed

+164
-155
lines changed

ij-plugin/src/main/kotlin/org/jetbrains/research/tasktracker/config/ide/settings/Theme.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ enum class Theme {
66
*/
77
DEFAULT,
88
LIGHT,
9-
DARCULA
9+
DARCULA,
10+
DARK
1011
}

ij-plugin/src/main/kotlin/org/jetbrains/research/tasktracker/handler/ide/SettingsHandler.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class SettingsHandler(override val config: SettingsConfig, override val project:
5555
when (config.theme) {
5656
Theme.DEFAULT -> {}
5757
Theme.LIGHT -> changeTheme(light)
58+
Theme.DARK -> changeTheme(dark)
5859
Theme.DARCULA -> changeTheme(darcula)
5960
}
6061
lafManager.updateUI()
@@ -74,7 +75,8 @@ class SettingsHandler(override val config: SettingsConfig, override val project:
7475

7576
companion object {
7677
const val zenModeActionId = "ToggleZenMode"
77-
const val darcula = "Darcula"
78+
const val dark = "Dark"
7879
const val light = "Light"
80+
const val darcula = "Light"
7981
}
8082
}

ij-plugin/src/main/kotlin/org/jetbrains/research/tasktracker/models/Extension.kt

+1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ enum class Extension(val ext: String) {
77
KOTLIN(".kt"),
88
CPP(".cpp"),
99
CSV(".csv"),
10+
JAVASCRIPT(".js"),
1011
NO_EXTENSION("")
1112
}

ij-plugin/src/main/kotlin/org/jetbrains/research/tasktracker/tracking/TrackingService.kt

+12-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.jetbrains.research.tasktracker.tracking
22

33
import com.intellij.openapi.Disposable
4+
import com.intellij.openapi.application.WriteAction
45
import com.intellij.openapi.components.Service
56
import com.intellij.openapi.project.Project
67
import kotlinx.coroutines.CoroutineScope
@@ -53,15 +54,17 @@ class TrackingService : Disposable {
5354
trackers.forEach {
5455
it.stopTracking()
5556
}
56-
CoroutineScope(Dispatchers.IO).launch {
57-
val result = trackers.all {
58-
it.send()
59-
}.and(
60-
logs.all { it.send() }
61-
)
62-
trackers.clear()
63-
logs.clear()
64-
if (result) success.invoke() else failure.invoke()
57+
WriteAction.run<Throwable> {
58+
CoroutineScope(Dispatchers.IO).launch {
59+
val result = trackers.all {
60+
it.send()
61+
}.and(
62+
logs.all { it.send() }
63+
)
64+
trackers.clear()
65+
logs.clear()
66+
if (result) success.invoke() else failure.invoke()
67+
}
6568
}
6669
}
6770

ij-plugin/src/main/kotlin/org/jetbrains/research/tasktracker/ui/main/panel/MainPluginWindow.kt

+5-4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ class MainPluginWindow(service: MainWindowService) {
3333
app.connect().subscribe(
3434
LafManagerListener.TOPIC,
3535
LafManagerListener {
36-
if (currentTheme != Theme.currentIdeTheme()) {
37-
currentTheme = Theme.currentIdeTheme()
38-
loadHtmlTemplate(currentTemplate)
39-
}
36+
// TODO should be replaced for new API
37+
// if (currentTheme != Theme.currentIdeTheme()) {
38+
// currentTheme = Theme.currentIdeTheme()
39+
// loadHtmlTemplate(currentTemplate)
40+
// }
4041
}
4142
)
4243
listenRedirectToDefaultBrowser()

ij-plugin/src/main/kotlin/org/jetbrains/research/tasktracker/ui/main/panel/panelStates/DefaultStates.kt

+3
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ fun Panel.processScenario() {
174174

175175
is ExternalSourceUnit -> {
176176
openExternalUrl(unit.url)
177+
setNextAction{
178+
processScenario()
179+
}
177180
}
178181

179182
null -> {

ij-plugin/src/main/resources/org/jetbrains/research/tasktracker/config/content/task/a.java

-42
This file was deleted.

ij-plugin/src/main/resources/org/jetbrains/research/tasktracker/config/content/task/b.java

-39
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
function binarySearch(arr, target) {
2+
let left = 0;
3+
let right = arr.length - 1;
4+
5+
while (left <= right) {
6+
// let middle = Math.floor((left + right) / 2);
7+
if (arr[middle] === target) {
8+
return middle;
9+
} else if (arr[middle] < target) {
10+
// left = middle + 1;
11+
} else {
12+
// right = middle - 1;
13+
}
14+
}
15+
return -1;
16+
}
17+
18+
console.log(binarySearch([10, 26, 34, 41, 52], 41)); // should return 3
19+
console.log(binarySearch([1, 3, 5, 7, 9], 5)); // should return 2
20+
console.log(binarySearch([2, 4, 6, 8, 10, 12], 11)); // should return -1

ij-plugin/src/main/resources/org/jetbrains/research/tasktracker/config/content/task/c.java

-50
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Function definitions for reference
2+
def get_even_numbers_list():
3+
return [num for num in range(101) if num % 2 == 0]
4+
5+
6+
def get_even_numbers_set():
7+
return {num for num in range(101) if num % 2 == 0}
8+
9+
10+
# Calls and Assertions
11+
def test_functions():
12+
# Call the get_even_numbers_list function and assert its correctness
13+
even_list_1 = get_even_numbers_list()
14+
assert even_list_1 == [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
15+
40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76,
16+
78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100]
17+
even_list_2 = get_even_numbers_list()
18+
assert len(even_list_2) == 51 # Assert that the list contains exactly 51 elements
19+
20+
# Call the get_even_numbers_set function and assert its correctness
21+
even_set_1 = get_even_numbers_set()
22+
assert even_set_1 == {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
23+
40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76,
24+
78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100}
25+
even_set_2 = get_even_numbers_set()
26+
assert 100 in even_set_2 # Assert that 100 is in the set
27+
28+
29+
# Execute the test function to validate both functions
30+
test_functions()

ij-plugin/src/main/resources/org/jetbrains/research/tasktracker/config/content/task/comparison.py

-5
This file was deleted.

ij-plugin/src/main/resources/org/jetbrains/research/tasktracker/config/content/task/list.py

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Task {
2+
public static void main(String[] args) {
3+
int a = pow(2, 3);
4+
System.out.println(a); // Should be 8
5+
}
6+
7+
public static int pow(int a, int b) {
8+
// TODO
9+
return 0;
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
fun main() {
2+
val a = pow(2, 3)
3+
println(a) // Should be 8
4+
}
5+
6+
fun pow(a: Int, b: Int): Int = TODO()
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
11
scenario:
22
steps:
33
- units:
4+
- !<SingleList>
5+
taskIds:
6+
- "powKotlin"
7+
- "powJava"
8+
- !<List>
9+
taskIds:
10+
- "list"
11+
- "set"
12+
mode: SHUFFLED
13+
- units:
14+
- !<Setting>
15+
mainIdeConfig:
16+
settingsConfig:
17+
enableCodeCompletion: OFF
18+
enableZenMode: OFF
19+
theme: DARK
420
- !<Task>
5-
id: "main"
21+
id: "binary"
22+
- units:
623
- !<Survey>
724
id: "default"
25+
- !<External>
26+
url: "https://www.youtube.com/watch?v=xvFZjo5PgG0"
27+
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,51 @@
11
tasks:
2-
- description: "Description should be specified here"
3-
id: main
4-
name: "Name Example"
2+
- description: "Create pow method for java language"
3+
id: powJava
4+
name: "Pow Java"
5+
focusFileId: "powJava"
6+
files:
7+
- filename: pow
8+
sourceSet: "SRC"
9+
templateFile: "pow"
10+
extension: JAVA
11+
id: "powJava"
12+
- description: "Create pow function for kotlin language"
13+
id: powKotlin
14+
name: "Pow Kotlin"
15+
focusFileId: "powKotlin"
16+
files:
17+
- filename: pow
18+
sourceSet: "SRC"
19+
templateFile: "pow"
20+
extension: KOTLIN
21+
id: "powKotlin"
22+
- description: "Implement binary algorithm"
23+
id: binary
24+
name: "Binary algorithm"
25+
focusFileId: "binary"
26+
files:
27+
- filename: binary
28+
sourceSet: "SRC"
29+
templateFile: "binary"
30+
extension: JAVASCRIPT
31+
id: "binary"
32+
- description: "implement function `get_even_numbers_set` that generates and returns a set containing all even numbers between 0 and 100, inclusive."
33+
id: set
34+
name: "Even Set"
35+
focusFileId: "collections"
36+
files:
37+
- filename: collections
38+
sourceSet: "SRC"
39+
templateFile: "collections"
40+
extension: PYTHON
41+
id: "collections"
42+
- description: "implement function `get_even_numbers_list` that generates and returns a list containing all even numbers between 0 and 100, inclusive."
43+
id: list
44+
name: "Even List"
45+
focusFileId: "collections"
46+
files:
47+
- filename: collections
48+
sourceSet: "SRC"
49+
templateFile: "collections"
50+
extension: PYTHON
51+
id: "collections"

0 commit comments

Comments
 (0)