1+ import React from 'react' ;
2+ import { FormattedMessage } from 'react-intl' ;
3+ import { defaultMemoize } from 'reselect' ;
4+ import Explanation from '../widgets/Explanation' ;
5+
6+ const syncMessages = {
7+ supplementaryFiles : (
8+ < FormattedMessage id = "app.assignment.syncSupplementaryFiles" defaultMessage = "Supplementary files" />
9+ ) ,
10+ attachmentFiles : < FormattedMessage id = "app.assignment.syncAttachmentFiles" defaultMessage = "Text attachment files" /> ,
11+ exerciseTests : < FormattedMessage id = "app.assignment.syncExerciseTests" defaultMessage = "Exercise tests" /> ,
12+ localizedTexts : < FormattedMessage id = "app.assignment.syncLocalizedTexts" defaultMessage = "Localized texts" /> ,
13+ configurationType : (
14+ < FormattedMessage
15+ id = "app.assignment.syncConfigurationType"
16+ defaultMessage = "Configuration was switched to advanced mode"
17+ />
18+ ) ,
19+ scoreConfig : < FormattedMessage id = "app.assignment.syncScoreConfig" defaultMessage = "Score configuration" /> ,
20+ exerciseConfig : < FormattedMessage id = "app.assignment.syncExerciseConfig" defaultMessage = "Exercise configuration" /> ,
21+ runtimeEnvironments : (
22+ < FormattedMessage id = "app.assignment.syncRuntimeEnvironments" defaultMessage = "Selection of runtime environments" />
23+ ) ,
24+ exerciseEnvironmentConfigs : (
25+ < FormattedMessage id = "app.assignment.syncExerciseEnvironmentConfigs" defaultMessage = "Environment configuration" />
26+ ) ,
27+ hardwareGroups : < FormattedMessage id = "app.assignment.syncHardwareGroups" defaultMessage = "Hardware groups" /> ,
28+ limits : < FormattedMessage id = "app.assignment.syncLimits" defaultMessage = "Limits" /> ,
29+ mergeJudgeLogs : (
30+ < span >
31+ < FormattedMessage id = "app.assignment.syncMergeJudgeLogs" defaultMessage = "Judge logs merge flag" />
32+ < Explanation id = "syncMergeJudgeLogs" >
33+ < FormattedMessage
34+ id = "app.exercise.mergeJudgeLogsExplanation"
35+ defaultMessage = "The merge flag indicates whether primary (stdout) and secondary (stderr) judge logs are are concatenated in one log (which should be default for built-in judges). If the logs are separated, the visibility of each part may be controlled idividually in assignments. That might be helpful if you need to pass two separate logs from a custom judge (e.g., one is for students and one is for supervisors)."
36+ />
37+ </ Explanation >
38+ </ span >
39+ ) ,
40+ } ;
41+
42+ export const getSyncMessages = syncInfo => {
43+ const res = [ ] ;
44+ for ( const field in syncMessages ) {
45+ if ( ! syncInfo [ field ] ) {
46+ continue ;
47+ }
48+
49+ if ( ! syncInfo [ field ] . upToDate ) {
50+ res . push ( < li key = { field } > { syncMessages [ field ] } </ li > ) ;
51+ }
52+ }
53+ return res ;
54+ } ;
55+
56+ export const isUpToDate = defaultMemoize ( syncInfo =>
57+ Object . keys ( syncMessages ) . every ( field => syncInfo [ field ] && syncInfo [ field ] . upToDate )
58+ ) ;
59+
160export const compareAssignments = ( a , b ) => {
261 // first compare by deadline
362 if ( a . firstDeadline < b . firstDeadline ) {
@@ -19,8 +78,8 @@ export const compareAssignments = (a, b) => {
1978 // if second deadlines are equal, continue
2079 }
2180
22- // none of them have second deadline or they are queal , compare creation times
23- return b . createdAt - a . createdAt ;
81+ // none of them have second deadline or they are equal , compare creation times
82+ return b . createdAt - a . createdAt || a . id . localeCompare ( b . id ) ;
2483 }
2584 } else {
2685 return 1 ;
0 commit comments